/* ============================================================
   TeamClock — app.css
   Design: industrial-clean dashboard with strong typographic
   rhythm, monospace clock as focal hero, slate+indigo palette
   ============================================================ */

/* ── Reset & Custom Properties ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #181c27;
  --surface2:  #1f2436;
  --border:    #2a3045;
  --text:      #e8eaf2;
  --text-muted:#8892a8;
  --accent:    #6366f1;
  --accent-light: #818cf8;
  --green:     #10b981;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size:.875em; color: var(--accent-light); }

/* ── Top Nav ── */
.topnav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  color: var(--text); white-space: nowrap;
}
.nav-links {
  display: flex; align-items: center; gap: .25rem; flex: 1;
}
.nav-link {
  padding: .4rem .8rem; border-radius: 6px;
  font-size: .875rem; font-weight: 500; color: var(--text-muted);
  transition: background .15s, color .15s;
  display: flex; align-items: center; gap: .4rem;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface2); color: var(--text);
  text-decoration: none;
}
.nav-admin { color: var(--accent-light); }
.nav-user {
  display: flex; align-items: center; gap: .6rem; margin-left: auto;
}
.nav-name { font-size: .875rem; color: var(--text-muted); white-space: nowrap; }
.nav-logout {
  font-size: .8rem; color: var(--text-muted); padding: .3rem .6rem;
  border: 1px solid var(--border); border-radius: 6px;
}
.nav-logout:hover { color: var(--red); border-color: var(--red); text-decoration: none; }

/* ── Badge ── */
.badge {
  background: var(--accent); color: white;
  font-size: .7rem; font-weight: 700;
  padding: 1px 6px; border-radius: 100px;
  line-height: 1.4;
}

/* ── Main Layout ── */
.main-wrap {
  max-width: 1100px; margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Login Split Layout ── */
.login-body { background: var(--bg); }
.login-split {
  display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh;
}
.login-brand {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #6366f1 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 3rem;
}
.brand-content { max-width: 400px; }
.brand-logo { margin-bottom: 1.5rem; }
.brand-name {
  font-family: var(--font-display); font-size: 2.5rem; font-weight: 700;
  color: white; margin-bottom: .75rem;
}
.brand-tagline {
  color: rgba(255,255,255,.8); font-size: 1.1rem; line-height: 1.7;
  margin-bottom: 2rem;
}
.brand-features { display: flex; flex-direction: column; gap: .75rem; }
.brand-feature {
  display: flex; align-items: center; gap: .75rem;
  color: rgba(255,255,255,.9); font-size: .95rem;
}
.feat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; background: var(--bg);
}
.login-card { width: 100%; max-width: 400px; }
.login-title {
  font-family: var(--font-display); font-size: 1.75rem; font-weight: 700;
  margin-bottom: .5rem;
}
.login-sub { color: var(--text-muted); margin-bottom: 2rem; }
.login-hint { margin-top: 1.5rem; font-size: .8rem; color: var(--text-muted); }

/* ── Forms ── */
.field { margin-bottom: 1.25rem; }
.field label {
  display: block; font-size: .875rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: .4rem;
}
.label-optional { font-weight: 400; opacity: .6; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], select, textarea {
  width: 100%; padding: .65rem .9rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
textarea { resize: vertical; }
select { cursor: pointer; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .65rem 1.25rem;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  transition: opacity .15s, transform .1s, background .15s;
  text-decoration: none; line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: white; }
.btn-primary:hover { background: #4f46e5; }
.btn-full { width: 100%; }
.btn-ghost {
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn-approve { background: #052e16; color: var(--green); border: 1px solid #16a34a40; }
.btn-approve:hover { background: #14532d; }
.btn-deny    { background: #2d0e0e; color: var(--red);   border: 1px solid #ef444440; }
.btn-deny:hover    { background: #450a0a; }

/* ── Clock Hero ── */
.clock-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}
.clock-hero-inner { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.live-clock {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 500;
  letter-spacing: .05em;
  color: var(--text);
  line-height: 1;
}
.live-date { color: var(--text-muted); font-size: .95rem; }
.clock-status-row {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  justify-content: center;
}
.status-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem 1rem; border-radius: 100px;
  font-size: .875rem; font-weight: 600; border: 1px solid;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pill-sm {
  display: inline-flex; padding: .25rem .65rem;
  border-radius: 100px; font-size: .78rem; font-weight: 600;
}
.worked-today { font-size: .875rem; color: var(--text-muted); }
.worked-today strong { color: var(--text); }

.clock-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.btn-clock {
  padding: .75rem 1.75rem; font-size: 1rem;
  border-radius: var(--radius-lg);
}
.btn-in  { background: #052e16; color: var(--green); border: 1px solid #16a34a40; }
.btn-in:hover { background: #14532d; }
.btn-out { background: #2d0e0e; color: var(--red);   border: 1px solid #ef444440; }
.btn-out:hover { background: #450a0a; }
.btn-break { background: #2d1f00; color: var(--amber); border: 1px solid #f59e0b40; }
.btn-break:hover { background: #431d00; }

.action-msg {
  min-height: 1.4rem; font-size: .875rem; text-align: center;
  border-radius: 6px; padding: .4rem .8rem;
}
.action-msg-ok  { background: #052e16; color: var(--green); }
.action-msg-err { background: #2d0e0e; color: var(--red); }
.vacation-active-msg { font-size: .9rem; color: var(--text-muted); }

/* ── Sections ── */
.section { margin-bottom: 2rem; }
.section-title {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
  margin-bottom: 1rem; color: var(--text);
}

/* ── Team Grid ── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.team-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; align-items: center; gap: .85rem;
  transition: border-color .2s;
}
.team-card:hover { border-color: var(--accent); }
.team-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: white;
  flex-shrink: 0; position: relative;
}
.team-status-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.team-name { font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.team-status-label { font-size: .8rem; font-weight: 500; margin-top: .15rem; }
.role-tag {
  font-size: .68rem; font-weight: 600; padding: 1px 5px;
  background: #312e8130; color: var(--accent-light);
  border-radius: 4px; text-transform: uppercase; letter-spacing: .03em;
}

/* ── Avatar SM ── */
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white;
  flex-shrink: 0;
}

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-entry {
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.timeline-entry:last-child { border-bottom: none; }
.tl-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--border);
}
.timeline-clock_in  .tl-dot { background: var(--green); }
.timeline-clock_out .tl-dot { background: var(--red); }
.timeline-break_start .tl-dot { background: var(--amber); }
.timeline-break_end   .tl-dot { background: var(--accent); }
.tl-label { flex: 1; color: var(--text); text-transform: capitalize; }
.tl-time  { color: var(--text-muted); font-family: var(--font-mono); font-size: .82rem; }

/* ── Vacation List ── */
.vacation-list, .request-list { display: flex; flex-direction: column; gap: .6rem; }
.vacation-row, .request-row {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.vacation-dates, .request-dates { font-weight: 600; font-size: .9rem; }
.vacation-reason, .request-reason { flex: 1; color: var(--text-muted); font-size: .85rem; font-style: italic; }
.request-meta { display: flex; align-items: center; gap: .75rem; }
.request-submitted { font-size: .8rem; color: var(--text-muted); }
.vacation-status {
  padding: .25rem .65rem; border-radius: 100px;
  font-size: .78rem; font-weight: 600;
}
.vacation-pending  { background: #2d1f00; color: var(--amber); }
.vacation-approved { background: #052e16; color: var(--green); }
.vacation-denied   { background: #2d0e0e; color: var(--red); }

/* ── Card ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
  margin-bottom: 1.25rem;
}

/* ── Two-col Layout ── */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start;
}

/* ── Page Header ── */
.page-header { margin-bottom: 2rem; }
.page-title {
  font-family: var(--font-display); font-size: 1.75rem; font-weight: 700;
  margin-bottom: .35rem;
}
.page-sub { color: var(--text-muted); }

/* ── Alert ── */
.alert {
  padding: .8rem 1rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1.25rem;
}
.alert-error { background: #2d0e0e; color: var(--red); border: 1px solid #ef444430; }
.alert-ok    { background: #052e16; color: var(--green); border: 1px solid #10b98130; }

/* ── Tabs ── */
.tabs {
  display: flex; gap: .35rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border); padding-bottom: .75rem;
}
.tab-btn {
  padding: .45rem 1rem; border-radius: var(--radius);
  background: none; border: 1px solid transparent;
  color: var(--text-muted); cursor: pointer; font-size: .875rem;
  font-family: var(--font-body); font-weight: 500;
  display: flex; align-items: center; gap: .4rem;
  transition: all .15s;
}
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active {
  background: var(--surface2); color: var(--text);
  border-color: var(--border);
}
.tab-panel.hidden { display: none; }

/* ── Admin Request Cards ── */
.admin-request-list { display: flex; flex-direction: column; gap: .75rem; }
.admin-request-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
}
.adm-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: .95rem;
}
.adm-info { flex: 1; min-width: 160px; }
.adm-name  { font-weight: 600; font-size: .95rem; }
.adm-dates { color: var(--text-muted); font-size: .85rem; margin-top: .1rem; }
.adm-reason { color: var(--text-muted); font-style: italic; font-size: .83rem; margin-top: .15rem; }
.adm-submitted { color: var(--text-muted); font-size: .78rem; margin-top: .2rem; }
.adm-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ── Data Table ── */
.data-table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
}
.data-table th {
  text-align: left; padding: .65rem .9rem;
  color: var(--text-muted); font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.nowrap { white-space: nowrap; }
.muted  { color: var(--text-muted); }

/* ── Week Nav ── */
.week-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
}
.week-label {
  font-weight: 600; font-size: 1rem;
  display: flex; gap: .5rem; align-items: center;
}
.week-label em { font-style: normal; color: var(--accent-light); font-size: .85rem; }

/* ── Week Summary ── */
.week-summary {
  display: flex; gap: 1.5rem; margin-bottom: 2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
}
.summary-stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-value { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; color: var(--text); }
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── History Day ── */
.history-day {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden;
}
.history-day-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .85rem 1.1rem;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.history-date { font-weight: 600; font-size: .9rem; }
.history-day-total { font-family: var(--font-mono); font-size: .9rem; color: var(--green); }
.history-day .timeline { padding: .25rem 1.1rem; }

/* ── Empty States ── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-msg { color: var(--text-muted); font-size: .875rem; padding: 1.25rem 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .topnav { padding: .65rem 1rem; gap: .75rem; }
  .nav-links { display: none; }
  .nav-name { display: none; }
  .main-wrap { padding: 1rem; }
  .clock-hero { padding: 1.5rem 1rem; }
  .team-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .week-summary { flex-wrap: wrap; }
  .tabs { flex-wrap: wrap; }
  .admin-request-card { flex-direction: column; align-items: flex-start; }
}

/* ── UCM / Phone Badge on Team Cards ── */
.phone-badge {
  display: flex; align-items: center; gap: .35rem;
  margin-top: .3rem;
}
.phone-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  transition: background .4s;
}
.phone-label {
  font-size: .75rem; font-weight: 500;
  transition: color .4s;
}

/* ── CDR (Call Records) in History ── */
.cdr-section {
  border-top: 1px solid var(--border);
  padding: .6rem 1.1rem .8rem;
}
.cdr-header {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .5rem;
}
.cdr-title { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.cdr-loading { font-size: .78rem; color: var(--text-muted); font-style: italic; }
.cdr-summary {
  display: flex; gap: .5rem; align-items: center;
  font-size: .8rem; color: var(--text-muted);
  padding: .4rem 0 .6rem;
}
.cdr-sep { opacity: .4; }
.cdr-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.cdr-row:last-child { border-bottom: none; }
.cdr-dir-icon {
  font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0;
}
.cdr-inbound  .cdr-dir-icon { color: #10b981; }
.cdr-outbound .cdr-dir-icon { color: #6366f1; }
.cdr-parties { flex: 1; }
.cdr-time { color: var(--text-muted); font-family: var(--font-mono); font-size: .78rem; }
.cdr-duration { font-weight: 600; font-family: var(--font-mono); font-size: .78rem; }
.cdr-answered { color: #10b981; }
.cdr-missed   { color: #ef4444; }
.cdr-empty { font-size: .82rem; color: var(--text-muted); font-style: italic; padding: .4rem 0; }

/* ── UCM Settings Page ── */
.ucm-status-bar {
  padding: .85rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.75rem;
  font-size: .875rem; display: flex; align-items: center; gap: .75rem;
  border: 1px solid;
}
.ucm-on  { background: #052e16; border-color: #16a34a30; color: #86efac; }
.ucm-off { background: #2d0e0e; border-color: #ef444430; color: #fca5a5; }
.ucm-status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.ucm-on  .ucm-status-dot { background: #10b981; box-shadow: 0 0 6px #10b981; }
.ucm-off .ucm-status-dot { background: #ef4444; }
.ucm-test-link { color: inherit; font-weight: 600; }

.code-block {
  background: #0a0d14; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  overflow-x: auto;
}
.code-block pre {
  font-family: var(--font-mono); font-size: .8rem;
  color: var(--text-muted); white-space: pre; margin: 0;
}
.code-block strong { color: var(--green); }

.setup-steps {
  padding-left: 1.25rem; display: flex; flex-direction: column; gap: .5rem;
}
.setup-steps li { font-size: .875rem; color: var(--text-muted); }
.setup-steps li strong { color: var(--text); }
.setup-steps li code { font-size: .82rem; }

.feature-grid { display: flex; flex-direction: column; gap: 1.25rem; }
.feature-item { display: flex; gap: 1rem; align-items: flex-start; }
.feature-icon { font-size: 1.5rem; flex-shrink: 0; width: 2rem; text-align: center; }
.feature-name { font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.feature-desc { font-size: .83rem; color: var(--text-muted); line-height: 1.6; }

/* ── Server IP Bar ── */
.server-ip-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1.25rem;
  margin-bottom: 1.25rem;
}
.server-ip-left {
  display: flex; align-items: center; gap: .75rem;
}
.server-ip-label {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
.server-ip-value {
  font-family: var(--font-mono); font-size: 1rem; font-weight: 600;
  color: var(--accent-light); background: var(--surface2);
  padding: .25rem .65rem; border-radius: 6px; border: 1px solid var(--border);
}
.btn-copy {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  padding: .3rem .65rem; font-size: .78rem; font-family: var(--font-body);
  cursor: pointer; transition: all .15s;
}
.btn-copy:hover { color: var(--text); border-color: var(--accent); }
.server-ip-hint {
  font-size: .8rem; color: var(--text-muted);
}
.server-ip-hint strong { color: var(--text); }
