* { box-sizing: border-box; margin: 0; padding: 0; }
:root{
  --blue:#305496; --gray:#bfbfbf; --line:#e3e6ea;
  --c1h:#c00000; --c1r:#ffc7ce;
  --c2h:#b45f06; --c2r:#fce4d6;
  --c3h:#bf9000; --c3r:#fff2cc;
  --c4h:#38761d; --c4r:#e2efda;
  --input:#fff8c6;
}
html,body{ font-family:Calibri,"Segoe UI",Arial,sans-serif; background:#f4f6f8; color:#1f2733; height:100%; }
.hidden{ display:none !important; }

/* login */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#305496,#1f3a6b); }
.login-card{ background:#fff; padding:34px 30px; border-radius:14px; width:320px; box-shadow:0 12px 40px rgba(0,0,0,.25); text-align:center; }
.login-card h1{ font-size:22px; color:var(--blue); }
.login-card .sub{ color:#6b7280; margin:4px 0 20px; font-size:14px; }
.login-card input{ width:100%; padding:11px 12px; border:1px solid #cfd6dd; border-radius:8px; font-size:15px; margin-bottom:12px; }
.login-card button{ width:100%; padding:11px; background:var(--blue); color:#fff; border:0; border-radius:8px; font-size:15px; cursor:pointer; }
.login-card button:hover{ background:#264a86; }
.err{ color:#c00000; font-size:13px; margin-top:10px; min-height:16px; }

/* topbar */
.topbar{ display:flex; align-items:center; justify-content:space-between; background:var(--blue); color:#fff; padding:10px 16px; position:sticky; top:0; z-index:20; }
.brand{ font-size:18px; font-weight:bold; }
.muted{ opacity:.7; font-weight:normal; font-size:14px; }
.actions{ display:flex; gap:8px; align-items:center; }
.btn{ background:#fff; color:var(--blue); border:0; padding:8px 12px; border-radius:7px; cursor:pointer; font-size:14px; font-weight:bold; }
.btn:hover{ background:#eef2f9; }
.btn.upload{ background:#ffd966; color:#5b4708; }
.sync{ font-size:12px; opacity:.85; min-width:60px; }

/* tabs */
.tabs{ display:flex; gap:2px; background:#e8ecf1; padding:6px 10px 0; position:sticky; top:52px; z-index:19; flex-wrap:wrap; }
.tab{ padding:9px 16px; background:#d5dbe3; border:0; border-radius:8px 8px 0 0; cursor:pointer; font-size:14px; font-weight:bold; color:#3a4657; }
.tab.active{ background:#fff; color:var(--blue); box-shadow:0 -2px 6px rgba(0,0,0,.06); }
.tab .cnt{ background:#305496; color:#fff; border-radius:10px; padding:0 7px; font-size:11px; margin-inline-start:6px; }

/* sheet */
.sheet{ padding:12px; }
.toolbar{ display:flex; align-items:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.filter{ flex:1; min-width:240px; max-width:520px; padding:8px 12px; border:1px solid #cfd6dd; border-radius:8px; font-size:14px; font-family:inherit; }
.btn-sm{ background:var(--blue); color:#fff; border:0; border-radius:6px; padding:6px 12px; cursor:pointer; font-size:13px; font-weight:bold; }
.btn-sm:hover{ background:#264a86; }
.hint{ color:#6b7280; font-size:12px; }
table.grid{ width:100%; border-collapse:collapse; background:#fff; font-size:13px; box-shadow:0 1px 4px rgba(0,0,0,.06); }
table.grid th{ background:var(--blue); color:#fff; padding:8px 6px; position:sticky; top:96px; z-index:10; white-space:nowrap; }
table.grid th.sortable{ cursor:pointer; user-select:none; }
table.grid th.sortable:hover{ background:#3a63a8; }
tr.add-row td{ background:#eef4ff; }
tr.add-row input{ width:100%; }
table.grid td{ border:1px solid var(--gray); padding:5px 7px; text-align:center; }
tr.cat td{ font-weight:bold; color:#fff; text-align:center; font-size:15px; padding:7px; }
tr.cat.c1 td{ background:var(--c1h);} tr.cat.c2 td{ background:var(--c2h);}
tr.cat.c3 td{ background:var(--c3h);} tr.cat.c4 td{ background:var(--c4h);}
tr.r1 td{ background:var(--c1r);} tr.r2 td{ background:var(--c2r);}
tr.r3 td{ background:var(--c3r);} tr.r4 td{ background:var(--c4r);}
td.part{ font-family:Consolas,monospace; direction:ltr; }
td input.cell{ border:1px solid #cfd6dd; border-radius:5px; padding:3px 5px; font-size:12px; width:120px; text-align:center; background:#fff; font-family:inherit; }
td.needdate input.cell{ background:var(--input); border-color:#e0c200; }
.late{ color:#c00000; font-weight:bold; }
.mail-btn{ background:#0563c1; color:#fff; border:0; border-radius:6px; padding:5px 9px; cursor:pointer; font-size:12px; font-weight:bold; white-space:nowrap; }
.mail-btn:hover{ background:#044a94; }
.mail-btn.nomail{ background:#9aa3af; }
.del-btn{ background:transparent; border:0; cursor:pointer; font-size:15px; opacity:.6; }
.del-btn:hover{ opacity:1; }
.add-form{ display:flex; flex-direction:column; gap:8px; }
.add-form label{ display:flex; flex-direction:column; font-size:13px; color:#3a4657; gap:3px; }
.add-form input, .add-form select{ padding:7px 9px; border:1px solid #cfd6dd; border-radius:6px; font-size:14px; font-family:inherit; }
.empty{ text-align:center; padding:60px 20px; color:#6b7280; }

/* modal */
.modal{ position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal-card{ background:#fff; border-radius:12px; width:min(760px,94vw); max-height:88vh; display:flex; flex-direction:column; }
.modal-head{ display:flex; justify-content:space-between; align-items:center; padding:14px 18px; border-bottom:1px solid var(--line); }
.modal-head h2{ font-size:18px; color:var(--blue); }
.modal-body{ overflow:auto; padding:14px 18px; }
table.sup-table{ width:100%; border-collapse:collapse; font-size:13px; }
table.sup-table th{ background:var(--blue); color:#fff; padding:8px; position:sticky; top:0; }
table.sup-table td{ border:1px solid var(--line); padding:4px 6px; }
table.sup-table td:first-child{ text-align:right; }
table.sup-table input{ width:100%; border:1px solid #d7dde4; border-radius:5px; padding:5px; direction:ltr; text-align:left; font-family:inherit; }

.modal-foot{ display:flex; align-items:center; gap:10px; padding:12px 18px; border-top:1px solid var(--line); }
.btn-sm.ghost{ background:#eef2f9; color:var(--blue); }
.prev-meta{ background:#f4f6f8; border:1px solid var(--line); border-radius:8px; padding:10px 12px; margin-bottom:12px; font-size:13px; line-height:1.7; }
.prev-body{ border:1px solid var(--line); border-radius:8px; padding:14px; max-height:46vh; overflow:auto; }
.prev-msg{ font-size:13px; color:#3a4657; }
.modal-note{ padding:0 18px 14px; font-size:12.5px; color:#6b7280; line-height:1.6; }

/* toast */
.toast{ position:fixed; bottom:20px; inset-inline-start:50%; transform:translateX(50%); background:#1f2733; color:#fff; padding:11px 18px; border-radius:8px; z-index:80; font-size:14px; box-shadow:0 6px 20px rgba(0,0,0,.3); }
