/* ══════════════════════════════════════════════════════════════
   Time Tracker — Main Stylesheet
══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.wrapper       { max-width: 1000px; margin: 0 auto; padding: 0 1.25rem 2.5rem; }
.page-header   { display: flex; align-items: center; justify-content: space-between;
                 padding: 1rem 0; margin-bottom: .25rem; flex-wrap: wrap; gap: 10px; }
.page-title    { font-size: 20px; font-weight: 700; color: #1a1a2e; display: flex; align-items: center; gap: 10px; }
.page-title small { font-size: 12px; font-weight: 400; color: #9ca3af;
                    background: #fff; padding: 3px 10px; border-radius: 20px; border: 1px solid #e5e7eb; }

/* ── Top Nav ──────────────────────────────────────────────── */
.top-nav {
  background: #1e293b;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.nav-brand {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  padding: 14px 14px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color .15s;
  text-decoration: none;
}
.nav-links a:hover  { color: #e2e8f0; }
.nav-links a.active { color: #fff; border-bottom-color: #3b82f6; }
.nav-logout { color: #94a3b8; font-size: 12px; padding: 6px 12px;
              border: 1px solid #334155; border-radius: 6px; transition: all .15s; text-decoration: none; }
.nav-logout:hover { color: #fff; border-color: #64748b; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 1rem;
}
.card-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-top: -12px;
  margin-bottom: 1rem;
}

/* ── Metric Cards ─────────────────────────────────────────── */
.metric-row  { display: flex; gap: 10px; margin-bottom: 1rem; flex-wrap: wrap; }
.metric      { background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 8px;
               padding: .9rem 1rem; flex: 1; min-width: 110px; transition: all .3s; }
.metric .lbl { font-size: 11px; color: #6b7280; margin-bottom: 5px;
               text-transform: uppercase; letter-spacing: .04em; }
.metric .val { font-size: 22px; font-weight: 700; line-height: 1.1; transition: color .3s; }
.metric .sub { font-size: 11px; color: #9ca3af; margin-top: 3px; }

/* Tier states */
.metric.tier-ok       { background: #f0fdf4; border-color: #bbf7d0; }
.metric.tier-ok .val  { color: #15803d; }
.metric.tier-warn     { background: #fffbeb; border-color: #fde68a; }
.metric.tier-warn .val{ color: #b45309; }
.metric.tier-alert     { background: #fff7ed; border-color: #fed7aa; }
.metric.tier-alert .val{ color: #c2410c; }
.metric.tier-critical  { background: #fff1f2; border-color: #fda4af; animation: pulse-bdr 1.4s infinite; }
.metric.tier-critical .val { color: #be123c; }
@keyframes pulse-bdr { 0%,100%{border-color:#fda4af} 50%{border-color:#f43f5e} }

/* ── Progress Bars ────────────────────────────────────────── */
.bar-wrap  { margin-bottom: 1rem; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-track { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; transition: width .4s, background .3s; }
.bf-blue   { background: #2563eb; }
.bf-green  { background: #16a34a; }
.bf-warn   { background: #f59e0b; }
.bf-red    { background: #e11d48; }
.bf-purple { background: #7c3aed; }

/* ── Badges ───────────────────────────────────────────────── */
.badge      { display: inline-block; font-size: 11px; font-weight: 600;
              padding: 3px 9px; border-radius: 20px; line-height: 1; }
.b-blue     { background: #dbeafe; color: #1d4ed8; }
.b-green    { background: #dcfce7; color: #15803d; }
.b-gray     { background: #f3f4f6; color: #6b7280; }
.b-amber    { background: #fef3c7; color: #92400e; }
.b-reg      { background: #dbeafe; color: #1d4ed8; }
.b-resp     { background: #dcfce7; color: #15803d; }

/* ── Avatars ──────────────────────────────────────────────── */
.avi    { width: 30px; height: 30px; border-radius: 50%; display: inline-flex;
          align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.avi-0  { background: #dbeafe; color: #1d4ed8; }
.avi-1  { background: #ede9fe; color: #6d28d9; }
.avi-2  { background: #dcfce7; color: #15803d; }
.avi-3  { background: #fef3c7; color: #92400e; }

/* ── Tables ───────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 8px 12px; font-size: 11px; color: #6b7280;
  font-weight: 600; border-bottom: 1px solid #e5e7eb;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
  background: #fafafa;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; color: #374151; }
table.data tr:last-child td { border-bottom: none; }
table.data td.r, table.data th.r { text-align: right; }
table.data td.c, table.data th.c { text-align: center; }
table.data .emp-cell { display: flex; align-items: center; gap: 9px; font-weight: 600; }
table.data tfoot td  { background: #f8f9fb; font-weight: 700; font-size: 12px;
                       color: #6b7280; border-top: 1px solid #e5e7eb; border-bottom: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn         { padding: 7px 14px; border: 1px solid #e5e7eb; border-radius: 7px;
               background: #fff; cursor: pointer; font-size: 12px; color: #374151;
               font-family: inherit; font-weight: 500; transition: all .15s; line-height: 1;
               display: inline-flex; align-items: center; gap: 5px; }
.btn:hover   { background: #f3f4f6; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 700; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger  { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm      { padding: 4px 10px; font-size: 11px; }
.btn-lg      { padding: 11px 22px; font-size: 14px; font-weight: 700; border-radius: 9px; }
.new-entry-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px;
  background: #2563eb; color: #fff; border: none; border-radius: 9px;
  cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(37,99,235,.3); transition: background .15s;
}
.new-entry-btn:hover { background: #1d4ed8; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 3px 6px;
            border-radius: 5px; font-size: 14px; color: #d1d5db; transition: all .15s; }
.icon-btn:hover { color: #dc2626; background: #fee2e2; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1.1rem; }
.form-label  { display: block; font-size: 11px; font-weight: 700; color: #6b7280;
               text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: #1a1a2e; background: #fff; transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px #dbeafe80; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
input[type=time].form-control { font-weight: 600; font-size: 15px; cursor: pointer; }

/* ── Type Toggle ──────────────────────────────────────────── */
.type-toggle { display: flex; border-radius: 8px; overflow: hidden; border: 1.5px solid #e5e7eb; }
.type-toggle button {
  flex: 1; padding: 11px; border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; background: #f8f9fb; color: #9ca3af; transition: all .15s;
}
.type-toggle button.sel-reg  { background: #dbeafe; color: #1d4ed8; }
.type-toggle button.sel-resp { background: #dcfce7; color: #15803d; }

/* ── Period Nav ───────────────────────────────────────────── */
.period-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 10px; padding: 1rem 1.25rem;
}
.period-nav .pnav-btn {
  background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 7px;
  padding: 7px 16px; cursor: pointer; font-size: 13px; color: #374151;
  font-family: inherit; font-weight: 500; text-decoration: none;
  transition: background .15s;
}
.period-nav .pnav-btn:hover { background: #e5e7eb; }
.period-nav .pnav-btn.disabled { opacity: .3; pointer-events: none; }
.period-center { text-align: center; }
.period-center .plabel { font-size: 15px; font-weight: 700; margin: 5px 0 3px; }
.period-center .psub   { font-size: 12px; color: #9ca3af; }

/* ── Day Accordion ────────────────────────────────────────── */
.day-list  { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.day-card  { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.day-card.is-today { border-color: #93c5fd; }
.day-card.is-open  { border-color: #bfdbfe; }
.day-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; user-select: none;
}
.day-header:hover { background: #f8f9fb; }
.dh-date  { font-size: 13px; font-weight: 600; color: #374151; white-space: nowrap; min-width: 132px; }
.dh-date.wknd  { color: #9ca3af; font-weight: 500; }
.dh-date.today { color: #1d4ed8; font-weight: 700; }
.today-pill { font-size: 10px; background: #2563eb; color: #fff;
              padding: 1px 6px; border-radius: 4px; vertical-align: middle; margin-left: 6px; }
.dh-chips  { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.chip      { display: inline-flex; align-items: center; gap: 3px; font-size: 11px;
             font-weight: 600; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.chip-reg   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.chip-resp  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.chip-mixed { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.chip-empty { color: #d1d5db; font-size: 11px; font-style: italic; font-weight: 400; }
.dh-tot    { font-size: 12px; font-weight: 700; color: #374151; white-space: nowrap; }
.dh-chev   { font-size: 16px; color: #d1d5db; transition: transform .2s; flex-shrink: 0; }
.day-card.is-open .dh-chev { transform: rotate(180deg); }
.day-body  { display: none; border-top: 1px solid #f3f4f6; }
.day-card.is-open .day-body { display: block; }
.day-empty { padding: 16px; text-align: center; color: #d1d5db; font-size: 13px; }

/* ── Period Strip ─────────────────────────────────────────── */
.period-strip {
  display: flex; gap: 16px; padding: 12px 1.25rem;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  margin-bottom: 1rem; flex-wrap: wrap; align-items: center;
}
.ps-item      { text-align: center; flex: 1; min-width: 70px; }
.ps-val       { font-size: 18px; font-weight: 700; line-height: 1.1; }
.ps-lbl       { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.ps-bar-item  { flex: 2; text-align: left; padding-left: 16px; border-left: 1px solid #f3f4f6; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; background: #fff; z-index: 1;
  border-radius: 14px 14px 0 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: #9ca3af; padding: 4px; border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: #f3f4f6; color: #374151; }
.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; bottom: 0; background: #fff; border-radius: 0 0 14px 14px;
}

/* ── Hours display box ────────────────────────────────────── */
.hours-display {
  background: #f0f9ff; border: 1.5px solid #bfdbfe; border-radius: 8px;
  padding: 9px 14px; text-align: center; flex-shrink: 0; min-width: 88px;
}
.hours-display .hd-val { font-size: 20px; font-weight: 700; color: #2563eb; }
.hours-display .hd-lbl { font-size: 10px; color: #93c5fd; text-transform: uppercase; letter-spacing: .04em; }
.time-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.time-field { flex: 1; min-width: 110px; }
.time-arrow { color: #d1d5db; font-size: 22px; padding-bottom: 10px; flex-shrink: 0; }

/* ── Date Grid (Thu-Wed layout) ───────────────────────────── */
.date-grid-wrap { background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; }
.dgrid-col-headers { display: grid; grid-template-columns: 50px repeat(7,1fr); gap: 4px; margin-bottom: 4px; }
.dgrid-col-hdr { font-size: 10px; font-weight: 700; color: #9ca3af; text-align: center;
                 text-transform: uppercase; letter-spacing: .04em; padding: 2px 0; }
.dgrid-col-hdr.wknd { color: #d1d5db; }
.dgrid-week-row { display: grid; grid-template-columns: 50px repeat(7,1fr); gap: 4px; margin-bottom: 4px; }
.dgrid-week-row:last-child { margin-bottom: 0; }
.dgrid-week-lbl { display: flex; align-items: center; justify-content: center; }
.dgrid-week-lbl span {
  font-size: 9px; font-weight: 700; color: #9ca3af; text-transform: uppercase;
  letter-spacing: .04em; background: #e5e7eb; border-radius: 4px; padding: 3px 5px; white-space: nowrap;
}
.date-btn {
  padding: 6px 3px; border: 1.5px solid #e5e7eb; border-radius: 7px; background: #fff;
  cursor: pointer; font-family: inherit; text-align: center; transition: all .15s;
  position: relative; user-select: none;
}
.date-btn:hover           { border-color: #93c5fd; background: #f0f9ff; }
.date-btn.selected        { border-color: #2563eb; background: #dbeafe; }
.date-btn.has-entry::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 5px; height: 5px; background: #f59e0b; border-radius: 50%;
}
.date-btn.is-today .db-num { color: #2563eb; font-weight: 800; }
.date-btn.wknd             { background: #fafafa; }
.date-btn.wknd .db-mon     { color: #d1d5db; }
.date-btn.wknd .db-num     { color: #c4b5c4; }
.date-btn.wknd.selected .db-mon,
.date-btn.wknd.selected .db-num { color: #1d4ed8; }
.date-btn.selected .db-mon { color: #93c5fd; }
.date-btn.selected .db-num { color: #1d4ed8; font-weight: 700; }
.db-mon { font-size: 9px; color: #9ca3af; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.db-num { font-size: 13px; font-weight: 600; color: #374151; margin-top: 1px; }
.date-quick-btns { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.dqb { padding: 4px 11px; border: 1px solid #e5e7eb; border-radius: 5px; background: #fff;
       cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 600; color: #6b7280; transition: all .15s; }
.dqb:hover { background: #e5e7eb; color: #374151; }

/* ── Entry Preview ────────────────────────────────────────── */
.entry-preview { border-radius: 8px; padding: 9px 14px; font-size: 13px;
                 font-weight: 600; text-align: center; margin-top: 10px; }
.preview-reg   { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.preview-resp  { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.preview-empty { background: #f9fafb; border: 1px dashed #e5e7eb; color: #9ca3af; font-weight: 400; }

/* ── Alert Box ────────────────────────────────────────────── */
.alert { border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 1rem; }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }
.alert-red  { background: #fff1f2; border: 1px solid #fda4af; color: #be123c; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* ── Settings Layout ──────────────────────────────────────── */
.settings-row { display: flex; align-items: center; justify-content: space-between;
                gap: 16px; padding: 1rem 0; border-bottom: 1px solid #f3f4f6; }
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.sr-lbl { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.sr-sub { font-size: 12px; color: #9ca3af; }
.num-input { width: 90px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 7px;
             font-size: 13px; background: #fff; color: #1a1a2e; font-family: inherit; text-align: center; }
.num-input:focus { outline: none; border-color: #2563eb; }

/* ── Misc Utilities ───────────────────────────────────────── */
.row-flex  { display: flex; align-items: center; gap: 10px; }
.text-muted { color: #9ca3af; }
.text-sm    { font-size: 12px; }
.fw-bold    { font-weight: 700; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mb-1  { margin-bottom: .5rem; }
.color-green { color: #15803d; font-weight: 700; }
.color-red   { color: #dc2626; font-weight: 700; }

/* ── Notifications (toast) ────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  background: #1e293b; color: #fff; padding: 12px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,.25);
  transform: translateY(20px); opacity: 0; transition: all .25s;
  pointer-events: none; max-width: 340px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.ok   { background: #15803d; }
#toast.err  { background: #be123c; }

/* ── Login ────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.login-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  padding: 2rem; width: 100%; max-width: 380px; text-align: center;
}
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: .5rem; }
.login-card p  { color: #9ca3af; font-size: 13px; margin-bottom: 1.5rem; }
