/* Clocky — design tokens from the approved design (IBM Plex Sans/Mono) */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/static/fonts/IBMPlexSans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('/static/fonts/IBMPlexSans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('/static/fonts/IBMPlexSans-600.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('/static/fonts/IBMPlexMono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('/static/fonts/IBMPlexMono-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url('/static/fonts/IBMPlexMono-600.woff2') format('woff2'); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { background: #F3F4F6; color: #15171C; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 15px; }
a { color: #2F4FD8; }
a:hover { color: #1E3AA8; }
button, input, select, textarea { font-family: inherit; }
.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
nav[aria-label="Main"] { flex: 1 1 232px; background: #15171C; color: #C9CDD6; padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.brand-name { font-size: 18px; font-weight: 600; color: #FFFFFF; letter-spacing: -0.01em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #8A909C; padding: 0 10px 6px; }
.nav { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: #C9CDD6; text-decoration: none; font-size: 14px; }
.nav:hover { background: #22262E; color: #FFFFFF; }
.nav.on { background: #2A2F3A; color: #FFFFFF; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid #2A2F3A; }
.me-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.me-name { font-size: 14px; color: #FFFFFF; }
.me-role { font-size: 12px; color: #A3A9B5; }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #FFFFFF; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 56px; display: flex; flex-direction: column; gap: 20px; }

/* generic */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.page-sub { font-size: 14px; color: #5F6673; }
.card { background: #FFFFFF; border: 1px solid #E2E4E9; border-radius: 12px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #E2E4E9; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.ib { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: #5F6673; cursor: pointer; }
.ib:hover { background: #EEF0F4; color: #15171C; }
.btn { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; border-radius: 8px; background: #2F4FD8; color: #FFFFFF; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #2440B8; }
.btn.dark { background: #15171C; }
.btn.dark:hover { background: #000000; }
.btn.ghost { border: 1px solid #D5D8DF; background: #FFFFFF; color: #15171C; font-weight: 500; }
.btn.ghost:hover { background: #F3F4F6; }
.btn.danger { background: #FFFFFF; border: 1px solid #D5D8DF; color: #9E2F0B; font-weight: 500; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: #3C424D; }
.in { height: 40px; border: 1px solid #D5D8DF; border-radius: 8px; padding: 0 12px; font-size: 14px; color: #15171C; background: #FFFFFF; }
.in:focus { outline: 2px solid #DCE3FB; border-color: #2F4FD8; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid #D5D8DF; border-radius: 8px; background: #FFFFFF; color: #15171C; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: #B9BFCB; }
.seg { display: flex; gap: 2px; padding: 3px; background: #E6E8EC; border-radius: 8px; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; color: #4A505C; cursor: pointer; }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: #FFFFFF; color: #15171C; }
.tag { height: 22px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.muted { color: #5F6673; }
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 14px; }
.alert.info { background: #E8EDFC; border: 1px solid #C3CEF5; color: #1C2B6B; }
.alert.warn { background: #FDF4EA; border: 1px solid #F0C89B; color: #6B3307; }
.alert.error { background: #FBE7E1; border: 1px solid #F0B7A8; color: #9E2F0B; }

/* tables */
.table { min-width: 700px; font-size: 14px; }
.trow { display: grid; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid #EEF0F4; }
.thead { padding: 10px 16px; background: #F8F9FA; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #5F6673; border-top: 0; }
.scroll-x { overflow-x: auto; }

/* popovers */
.pop { position: absolute; z-index: 20; background: #FFFFFF; border: 1px solid #E2E4E9; border-radius: 12px; box-shadow: 0 12px 32px rgba(21,23,28,.14); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.pop .opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; color: #15171C; cursor: pointer; text-align: left; }
.pop .opt:hover { background: #F3F4F6; }
.pop .opt[aria-selected="true"] { background: #F3F4F6; font-weight: 600; }
.pop-foot { margin-top: 4px; padding: 8px 4px 2px; border-top: 1px solid #EEF0F4; display: flex; justify-content: space-between; align-items: center; }

/* toast */
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #15171C; color: #FFFFFF; border-radius: 10px; font-size: 14px; box-shadow: 0 12px 32px rgba(21,23,28,.25); }
.toast.error { background: #9E2F0B; }

/* sign-in page */
.signin-wrap { min-height: 100vh; display: flex; flex-wrap: wrap; background: #F3F4F6; }
.signin-hero { flex: 1 1 420px; background: #15171C; color: #C9CDD6; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.signin-hero h2 { margin: 0; font-size: clamp(32px, 4vw, 48px); line-height: 1.08; font-weight: 600; letter-spacing: -0.025em; color: #FFFFFF; }
.signin-panel { flex: 999 1 480px; padding: clamp(28px, 5vw, 64px); display: flex; align-items: center; justify-content: center; }
.signin-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.signin-box h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.015em; }
.gbtn { height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid #C4C9D2; border-radius: 10px; background: #FFFFFF; color: #15171C; font-size: 16px; font-weight: 500; text-decoration: none; cursor: pointer; }
.gbtn:hover { border-color: #9AA1AE; }
.divider { display: flex; align-items: center; gap: 12px; color: #8A909C; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #E2E4E9; }

/* week bars (log page) */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-card { background: #FAFAFB; border: 1px solid #E2E4E9; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.day-card.today { background: #FFFFFF; border-color: #2F4FD8; }
.day-card.today .day-name { color: #2F4FD8; }
.day-head { display: flex; justify-content: space-between; gap: 4px; font-size: 12px; color: #5F6673; }
.day-name { font-weight: 600; color: #3C424D; }
.bar-wrap { height: 40px; display: flex; align-items: flex-end; }
.bar { width: 100%; border-radius: 3px; background: #9AA6C9; }
.bar.today { background: #2F4FD8; }

/* reports chart */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.chart .col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .seg-bar { width: 100%; }

/* summary bars */
.sum-row { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(160px, 3fr) 100px 64px; gap: 16px; align-items: center; padding: 12px 16px; }
.sum-child { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(160px, 3fr) 100px 64px; gap: 16px; align-items: center; padding: 8px 16px 8px 34px; border-top: 1px solid #F1F2F5; }
.track { height: 8px; background: #EEF0F4; border-radius: 4px; overflow: hidden; }
.track > span { display: block; height: 100%; background: #9AA1AE; }
.track.sm { height: 6px; border-radius: 3px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: #FFFFFF; border: 1px solid #E2E4E9; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat span { font-size: 13px; color: #5F6673; }
.stat strong { font-size: 28px; font-weight: 600; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(21,23,28,.4); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; }
.modal { width: 100%; max-width: 480px; background: #FFFFFF; border-radius: 14px; box-shadow: 0 24px 64px rgba(21,23,28,.3); display: flex; flex-direction: column; max-height: 84vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #E2E4E9; }
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid #E2E4E9; }

@media (max-width: 800px) {
  .sum-row, .sum-child { grid-template-columns: 1fr 80px 56px; }
  .sum-row .track, .sum-child .track { display: none; }
}
/* Responsive shell: sidebar stays compact; tables scroll inside cards. */
@media (min-width: 801px) {
  nav[aria-label="Main"] { flex: 0 0 232px; position: sticky; top: 0; height: 100vh; }
  .shell > main { flex: 1; }
}
@media (max-width: 800px) {
  .shell { display:block; }
  nav[aria-label="Main"] { padding:12px 16px; gap:12px; }
  .nav-group { flex-direction:row; flex-wrap:wrap; }
  .nav-heading { width:100%; padding:0; }
  .me { margin:0; padding:8px 0; }
  main { padding:20px 16px; }
  .week-grid { gap:4px; }
  .day-card { padding:8px 4px; }
  .day-head { flex-direction:column; }
  .export-layout { flex-direction:column; }
  .signin-wrap > section, body > div > section[aria-label="About Clocky"] { min-height:300px; }
}
.export-layout { display:flex; gap:24px; align-items:flex-start; }
.sheet { width:100%; border-collapse:collapse; font-size:13px; }
.sheet th { background:#15171C; color:white; position:sticky; top:0; }
.sheet th, .sheet td { text-align:left; padding:8px 12px; white-space:nowrap; border:1px solid #E2E4E9; }
.sheet tr:nth-child(even) { background:#F8F9FA; }
.export-layout aside h3 { font-size:14px; margin-bottom:8px; }
.export-layout aside p { font-size:13px; line-height:1.5; }
#proj-panel, #label-panel { flex-direction:column; }
#days { display:flex; flex-direction:column; gap:16px; }
:focus-visible { outline:2px solid #2F4FD8; outline-offset:3px; }
.fl { min-width:0; }
.fl > .in { width:100%; min-width:0; }
.gbtn:disabled { cursor:not-allowed; opacity:.65; }
#export-filename { min-width:0; overflow-wrap:anywhere; }
.export-layout > section { max-width:100%; }
@media (max-width:800px) {
  .export-layout > section { width:100%; flex:none; }
  .export-layout { width:100%; min-width:0; }
}
@media (max-width:800px) {
  #summary-section > div[style*="grid-template-columns"],
  #summary-body > div[style*="grid-template-columns"],
  .sum-row, .sum-child {
    grid-template-columns:minmax(0,1fr) 70px 45px !important;
    gap:8px !important;
    padding-left:12px !important;
    padding-right:12px !important;
  }
  .sum-row > :nth-child(2), .sum-child > :nth-child(2),
  #summary-section > div[style*="grid-template-columns"] > :nth-child(2),
  #summary-body > div[style*="grid-template-columns"] > :nth-child(2) { display:none; }
  .sum-row > :first-child, .sum-child > :first-child { min-width:0; overflow-wrap:anywhere; }
  #date-pop, #proj-pop, #eng-pop, #lab-pop {
    position:fixed; top:160px !important; left:16px !important; right:16px !important;
    width:auto !important; max-height:60vh; overflow:auto;
  }
  #date-pop > div[style*="display:flex"] { flex-wrap:wrap; }
  #date-pop input { width:100%; }
  .chip { max-width:100%; overflow-wrap:anywhere; }
}

/* Anchored, keyboard-friendly selects; native values remain the form source of truth. */
.custom-select { display:inline-flex;position:relative;min-width:0;max-width:100%;vertical-align:middle; }
.select-native { position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;opacity:0;clip-path:inset(50%);pointer-events:none; }
.select-trigger { width:100%;min-height:38px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 10px;border:1px solid #D5D8DF;border-radius:8px;background:#FFFFFF;color:#3C424D;font-size:13px;cursor:pointer;text-align:left; }
.select-trigger:hover { border-color:#9AA6C9;background:#FAFBFE; }
.select-trigger:focus-visible { outline:3px solid #DCE3FB;border-color:#2F4FD8; }
.select-trigger[aria-expanded="true"] { border-color:#2F4FD8;box-shadow:0 0 0 2px #E8EDFC; }
.select-trigger:disabled { opacity:.55;cursor:default; }
.select-value { display:flex;align-items:center;gap:7px;min-width:0; }
.select-text { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.select-chevron,.select-glyph { display:inline-flex;flex:none;color:#5F6673; }
.select-role .select-trigger { min-width:130px; }
.role-pill { font-size:12px;font-weight:600;border-radius:12px;padding:3px 8px;white-space:nowrap; }
.role-admin { background:#E8EDFC;color:#23399E; }
.role-engineer { background:#EEF0F4;color:#3C424D; }
.select-project { width:min(280px,100%); }
.select-menu { position:fixed;z-index:1000;display:flex;flex-direction:column;background:#FFFFFF;border:1px solid #E2E4E9;border-radius:12px;padding:6px;box-shadow:0 12px 32px rgba(21,23,28,.18);overflow:hidden;color:#15171C; }
.select-options { overflow-y:auto;min-height:0;overscroll-behavior:contain; }
.select-option { display:flex;align-items:center;gap:8px;padding:10px;min-height:40px;border-radius:7px;cursor:pointer;font-size:14px; }
.select-option.is-active { background:#F1F4FE; }
.select-option[aria-selected="true"] { color:#23399E;font-weight:500; }
.select-option .select-text { flex:1; }
.select-check { margin-left:auto;color:#2F4FD8; }
.select-search { flex:none;width:100%;margin-bottom:6px;height:36px; }
.select-empty { padding:16px 10px;font-size:13px;color:#5F6673; }
.token-list { display:flex;flex-direction:column; }
.token-row { display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px;border-top:1px solid #EEF0F4; }
.token-info { flex:1 1 260px;min-width:0; }
.token-name { font-weight:600;overflow-wrap:anywhere; }
.token-meta { display:flex;flex-wrap:wrap;gap:6px 16px;font-size:12px;color:#5F6673;margin-top:6px; }
.token-status { font-size:12px;padding:4px 9px;border-radius:14px;background:#DFF2EC;color:#0B5E4E; }
.token-status.inactive { background:#EEF0F4;color:#5F6673; }
.token-secret { width:100%;font-family:'IBM Plex Mono',monospace;font-size:13px; }
.token-config { white-space:pre-wrap;overflow-wrap:anywhere;padding:16px;background:#F8F9FA;border:1px solid #E2E4E9;border-radius:8px;font-size:12px;line-height:1.6; }
.token-dialog { margin:auto;width:min(540px,calc(100% - 32px));max-height:90vh;overflow:auto;padding:24px;color:#15171C; }
.token-dialog form,.token-dialog-body { display:flex;flex-direction:column;gap:16px; }
.token-dialog h2 { font-size:20px; }
.token-actions { display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap; }

/* Import upload controls and instructions must fit narrow screens. */
#import-form, #import-form > div, #import-form .fl { min-width:0; max-width:100%; }
#import-form p { overflow-wrap:anywhere; }
#import-file { width:100%; min-width:0; }
#import-results .scroll-x { max-width:100%; }
