/* ============================================================
   Timmy — brand stylesheet
   Navy #032255, Blue #1C6AFD, Slate #9BA4BB, Paper #F8FAFC
   ============================================================ */

:root {
  /* Brand palette */
  --brand:        #032255;       /* Timmy navy — primary */
  --brand-2:      #1C6AFD;       /* Bright blue — energy/accent */
  --brand-light:  #E8EFFE;       /* Very pale blue tint */
  --brand-xlight: #F2F6FF;       /* Card hover, subtle backgrounds */
  --slate:        #9BA4BB;       /* Muted secondary */
  --slate-light:  #C8CEDB;       /* Disabled, soft borders */

  /* Surface */
  --bg:          #F8FAFC;        /* App background */
  --surface:     #FFFFFF;        /* Cards */
  --border:      #E5E9F0;        /* Default border */
  --border-soft: #F0F3F8;        /* Inner dividers */

  /* Text */
  --text:        #0F172A;
  --text-2:      #475569;
  --text-3:      #94A3B8;

  /* Status */
  --success:     #059669;
  --success-bg:  #ECFDF5;
  --warning:     #D97706;
  --warning-bg:  #FFF8EB;
  --danger:      #DC2626;
  --danger-bg:   #FEF2F2;

  /* Radii */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;

  /* Shadow */
  --shadow:      0 1px 3px rgba(3, 34, 85, .06), 0 1px 2px rgba(3, 34, 85, .04);
  --shadow-lg:   0 8px 24px rgba(3, 34, 85, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); text-decoration: underline; }

/* ── Layout shell ─────────────────────────────────────────── */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header-logo { display: flex; align-items: center; gap: 10px; }
.app-header-logo img { height: 32px; }

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin-left: 24px;
}
.app-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.app-nav a:hover { background: var(--brand-xlight); color: var(--brand); text-decoration: none; }
.app-nav a.is-active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.app-header-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-2);
}
.app-header-user a { color: var(--text-2); }

main.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

/* ── Mobile nav ───────────────────────────────────────────── */
@media (max-width: 760px) {
  .app-header { padding: 0 14px; }
  .app-header-logo img { height: 28px; }
  .app-nav { display: none; }
  .app-nav.is-open { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 8px 14px; gap: 2px; }
  .app-nav.is-open a { padding: 12px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
  main.app-main { padding: 16px 14px 60px; }
}
@media (min-width: 761px) {
  .nav-toggle { display: none; }
}

/* ── Typography ───────────────────────────────────────────── */
.section-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 4px; letter-spacing: -.01em; }
.section-sub   { font-size: 14px; color: var(--text-2); margin: 0 0 18px; }

.text-muted { color: var(--text-3); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title { font-weight: 600; font-size: 15px; color: var(--text); }
.card-body  { padding: 18px; }
.card-body.empty-state { text-align: center; padding: 40px 18px; color: var(--text-2); }
.card-body.empty-state h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.card-body.empty-state p  { margin: 0 0 14px; font-size: 14px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .12s ease;
  line-height: 1;
}
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--brand-xlight); color: var(--brand); border-color: var(--brand-light); text-decoration: none; }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--brand-xlight); color: var(--brand); text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 200px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.form-label-required::after { content: ' *'; color: var(--danger); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(28, 106, 253, .12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid;
}
.flash-success { background: var(--success-bg); border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: var(--danger-bg);  border-color: #fecaca; color: #991b1b; }
.flash-warning { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }
.flash-info    { background: var(--brand-light); border-color: #c7d6ff; color: var(--brand); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-light);
  color: var(--brand);
  letter-spacing: .01em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-muted   { background: #f1f5f9;           color: var(--text-2); }

/* ── Tables / mobile rows ─────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 14px;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--brand-xlight); }
.data-table .actions { text-align: right; white-space: nowrap; }

@media (max-width: 700px) {
  .data-table { display: none; }
  .m-rows .m-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
  }
  .m-row-title { font-weight: 600; font-size: 14px; }
  .m-row-meta  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
}
@media (min-width: 701px) {
  .m-rows { display: none; }
}

/* ── Utility ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
