/* =============================================================
   BSGM School Office Portal — style.css
   Theme: Classic navy + white + light grey, gold accent
   Responsive: desktop, tablet, mobile
   ============================================================= */

:root {
  /* Palette */
  --navy-900: #0A1F3C;
  --navy-800: #0F2D52;
  --navy-700: #14376A;
  --navy-600: #1E4A8A;
  --navy-100: #E6ECF5;
  --grey-50:  #F8FAFC;
  --grey-100: #F4F6F9;
  --grey-200: #E5E9F0;
  --grey-300: #D1D7E0;
  --grey-400: #98A2B3;
  --grey-500: #6B7280;
  --grey-700: #374151;
  --grey-900: #111827;
  --white:    #FFFFFF;
  --gold:     #C68A2E;
  --gold-bg:  #FBF3E2;
  --red:      #C0392B;
  --red-bg:   #FDECEA;
  --green:    #1F8A4C;
  --green-bg: #E8F6EE;
  --amber:    #B7791F;
  --amber-bg: #FBF3E2;

  /* Typography */
  --font-body: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Georgia", "Times New Roman", serif;

  /* Spacing & radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,45,82,.06);
  --shadow-md: 0 4px 12px rgba(15,45,82,.08);
  --shadow-lg: 0 12px 28px rgba(15,45,82,.12);

  --nav-h: 124px; /* header height (used for sticky offset) */
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--grey-900);
  background: var(--grey-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-heading); margin: 0 0 .35em; line-height: 1.25; color: var(--navy-800); }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .6em; }
a { color: var(--navy-700); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ============ Header ============ */
.app-header {
  background: var(--navy-800);
  color: var(--white);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  max-width: 1100px;
  margin: 0 auto;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  background: var(--white);
  color: var(--navy-800);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.brand-text h1 {
  color: var(--white);
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: .2px;
}
.brand-text p {
  margin: 0;
  font-size: .75rem;
  color: var(--navy-100);
  letter-spacing: .4px;
  text-transform: uppercase;
}
.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--navy-100);
  background: rgba(255,255,255,.08);
  padding: 5px 10px;
  border-radius: 999px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px rgba(183,121,31,.25);
}
.status-dot.ok    { background: var(--green); box-shadow: 0 0 0 2px rgba(31,138,76,.25); }
.status-dot.error { background: var(--red);   box-shadow: 0 0 0 2px rgba(192,57,43,.25); }

/* ============ Tabs ============ */
.tabs {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1 1 25%;
  min-width: 110px;
  background: transparent;
  color: var(--navy-100);
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 14px 10px 12px;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.tab-btn:hover { background: rgba(255,255,255,.06); color: var(--white); }
.tab-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
  background: rgba(255,255,255,.1);
}
.tab-btn.active {
  color: var(--white);
  border-bottom-color: var(--gold);
  background: rgba(255,255,255,.08);
}
.tab-icon { font-size: 1.05rem; line-height: 1; }
.tab-label { font-size: .82rem; }

/* ============ Layout ============ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
.tab-panel { animation: fadeIn .25s ease; }
.tab-panel[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-sub { color: var(--grey-500); font-size: .9rem; margin: 0; }
.panel-actions { display: flex; gap: 8px; }
.hint-banner {
  width: 100%;
  background: var(--amber-bg);
  color: var(--amber);
  border-left: 4px solid var(--amber);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: .88rem;
  margin: 8px 0 14px;
}

/* ============ Notice Board ============ */
.notice-feed { display: flex; flex-direction: column; gap: 14px; }
.notice-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--navy-700);
  transition: box-shadow .15s;
}
.notice-card:hover { box-shadow: var(--shadow-md); }
.notice-card.urgent { border-left-color: var(--gold); background: linear-gradient(180deg, #FFFDF8 0%, var(--white) 60px); }
.notice-card.expired { opacity: .65; border-left-color: var(--grey-400); }
.notice-card.expired .notice-title { text-decoration: line-through; }
.notice-title { font-size: 1.08rem; margin-bottom: 4px; color: var(--navy-800); }
.notice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: .78rem;
  color: var(--grey-500);
  margin: 6px 0 10px;
}
.notice-meta span { display: inline-flex; align-items: center; gap: 4px; }
.notice-desc { font-size: .92rem; color: var(--grey-700); white-space: pre-wrap; word-wrap: break-word; }
.notice-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-100);
  color: var(--navy-800);
  font-weight: 500;
  border: 1px solid transparent;
}
.tag.urgent { background: var(--gold-bg); color: var(--gold); border-color: rgba(198,138,46,.3); }
.tag.meeting { background: var(--green-bg); color: var(--green); border-color: rgba(31,138,76,.25); }
.tag.expired { background: var(--grey-100); color: var(--grey-500); }
.tag.today { background: var(--navy-700); color: var(--white); }
.notice-section-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--grey-500);
  margin: 18px 0 6px;
  font-family: var(--font-body);
  font-weight: 600;
}

/* ============ Forms ============ */
.form-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: 1 / -1; }
.field label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--grey-700);
}
.field .req { color: var(--red); margin-left: 2px; }
.field .opt { color: var(--grey-400); font-weight: 400; font-size: .8rem; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: .95rem;
  padding: 10px 12px;
  border: 1px solid var(--grey-300);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--grey-900);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(20,55,106,.15);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--grey-100);
  color: var(--grey-500);
  cursor: not-allowed;
}
.field input.invalid, .field select.invalid, .field textarea.invalid {
  border-color: var(--red);
  background: var(--red-bg);
}
.field-hint { font-size: .78rem; color: var(--grey-500); }
.field-error {
  font-size: .78rem;
  color: var(--red);
  display: none;
  font-weight: 500;
}
.field.invalid .field-error, .field-error.show { display: block; }

.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--grey-300);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  background: var(--white);
  transition: border-color .15s, background .15s;
  font-size: .88rem;
}
.radio-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-pill:has(input:checked) {
  border-color: var(--navy-700);
  background: var(--navy-100);
  color: var(--navy-800);
  font-weight: 600;
}
.radio-pill:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Periods grid */
.periods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-sm);
}
.period-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1.5px solid var(--grey-300);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  cursor: pointer;
  font-size: .85rem;
  user-select: none;
  transition: border-color .15s, background .15s;
}
.period-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.period-chip:has(input:checked) {
  border-color: var(--navy-700);
  background: var(--navy-100);
  color: var(--navy-800);
  font-weight: 600;
}
.period-chip:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Filter select */
.filter-select select {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--grey-300);
  border-radius: var(--r-sm);
  background: var(--white);
  cursor: pointer;
}
.filter-select select:focus-visible { outline: 2px solid var(--navy-700); outline-offset: 1px; }

/* ============ Buttons ============ */
.btn {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
  line-height: 1.2;
}
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-800); color: var(--white); }
.btn-primary:hover { background: var(--navy-700); }
.btn-secondary { background: var(--white); color: var(--navy-800); border-color: var(--navy-700); }
.btn-secondary:hover { background: var(--navy-100); }
.btn-ghost { background: transparent; color: var(--grey-700); border-color: var(--grey-300); }
.btn-ghost:hover { background: var(--grey-100); }
.btn-danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #166B3B; }
.btn-warning { background: var(--amber); color: var(--white); }
.btn-warning:hover { background: #925E12; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ============ Spinner ============ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
.btn-spinner {
  border-color: rgba(255,255,255,.4);
  border-top-color: var(--white);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ State containers ============ */
.state {
  text-align: center;
  padding: 40px 20px;
  color: var(--grey-500);
  background: var(--white);
  border: 1px dashed var(--grey-300);
  border-radius: var(--r-md);
}
.state .spinner { border-color: var(--grey-300); border-top-color: var(--navy-700); margin-bottom: 8px; width: 22px; height: 22px; }
.state-error { color: var(--red); border-color: rgba(192,57,43,.4); background: var(--red-bg); }
.state-empty { color: var(--grey-500); }
.state-empty .empty-icon { font-size: 2.5rem; margin-bottom: 8px; display: block; }

/* ============ Success card ============ */
.success-card {
  background: var(--white);
  border: 1px solid var(--green);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-top: 20px;
}
.success-icon {
  width: 56px; height: 56px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  font-size: 28px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  font-weight: bold;
}
.success-card h3 { color: var(--green); margin-bottom: 8px; }
.success-card p { color: var(--grey-700); margin: 0 auto 16px; max-width: 540px; }

.work-id-box {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--navy-100);
  padding: 12px 18px;
  border-radius: var(--r-md);
  margin: 6px 0 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.work-id-label { color: var(--navy-800); font-weight: 600; font-size: .85rem; }
.work-id {
  font-family: "Courier New", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: 1px;
}
.email-suggest {
  background: var(--grey-50);
  padding: 14px;
  border-radius: var(--r-md);
  margin: 14px auto;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.email-suggest-label { color: var(--grey-500); font-size: .82rem; width: 100%; text-align: center; margin-bottom: 4px; }
.email-suggest code {
  background: var(--white);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--grey-200);
  font-size: .85rem;
  color: var(--navy-800);
  flex: 1 1 200px;
  word-break: break-word;
}
.success-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

/* ============ Footer ============ */
.app-footer {
  background: var(--navy-900);
  color: var(--navy-100);
  padding: 16px 20px;
  margin-top: 40px;
  border-top: 3px solid var(--gold);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  font-size: .82rem;
}
.footer-sub { color: var(--grey-400); font-size: .75rem; margin-top: 4px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-900);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: 90vw;
  font-size: .9rem;
  opacity: 0;
  transition: transform .25s, opacity .25s;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-error { background: var(--red); }
.toast.toast-success { background: var(--green); }

/* =============================================================
   ADMIN PAGE STYLES (admin.html uses the same style.css)
   ============================================================= */

.admin-login {
  max-width: 420px;
  margin: 80px auto;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.admin-login h2 { text-align: center; margin-bottom: 6px; }
.admin-login .login-sub { text-align: center; color: var(--grey-500); font-size: .85rem; margin-bottom: 20px; }
.admin-login .field { margin-bottom: 14px; }

/* Admin layout */
.admin-header {
  background: var(--navy-900);
  color: var(--white);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; z-index: 100;
}
.admin-header .brand { gap: 10px; }
.admin-header .brand-mark { width: 32px; height: 32px; font-size: 18px; }
.admin-header h1 { color: var(--white); font-size: 1rem; margin: 0; }
.admin-header .admin-tag {
  background: var(--gold);
  color: var(--navy-900);
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: .5px;
  margin-left: 8px;
}
.admin-user { display: flex; align-items: center; gap: 12px; font-size: .85rem; }
.admin-user .user-name { font-weight: 500; }
.btn-logout { font-size: .8rem; padding: 6px 12px; }

/* Admin nav */
.admin-nav {
  background: var(--navy-800);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav button {
  background: transparent;
  color: var(--navy-100);
  border: 0;
  padding: 12px 16px;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.admin-nav button:hover { background: rgba(255,255,255,.06); color: var(--white); }
.admin-nav button.active { color: var(--white); border-bottom-color: var(--gold); background: rgba(255,255,255,.08); }

/* Summary cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.summary-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--navy-700);
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
}
.summary-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.summary-card.urgent { border-top-color: var(--gold); }
.summary-card.warn   { border-top-color: var(--amber); }
.summary-card.danger { border-top-color: var(--red); }
.summary-card.ok     { border-top-color: var(--green); }
.summary-card .count { font-size: 2rem; font-weight: 700; color: var(--navy-800); font-family: var(--font-heading); line-height: 1; }
.summary-card .label { color: var(--grey-500); font-size: .82rem; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* Tables */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.table-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-200);
  background: var(--grey-50);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.table-toolbar input, .table-toolbar select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--grey-300);
  border-radius: var(--r-sm);
  background: var(--white);
  font-size: .85rem;
}
.table-toolbar input[type="search"] { min-width: 180px; flex: 1 1 220px; }
.table-toolbar input:focus, .table-toolbar select:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(20,55,106,.15); }
.table-toolbar .toolbar-label { font-size: .82rem; color: var(--grey-500); font-weight: 500; }

.table-scroll { overflow-x: auto; max-height: 560px; overflow-y: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}
table.data thead th {
  background: var(--navy-100);
  color: var(--navy-800);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--grey-200);
  position: sticky; top: 0;
  white-space: nowrap;
  cursor: default;
}
table.data tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grey-100);
  vertical-align: top;
}
table.data tbody tr:hover { background: var(--grey-50); }
table.data tbody tr.row-urgent { background: #FFFDF8; }
table.data tbody tr.row-urgent:hover { background: #FBF3E2; }
table.data tbody tr.row-overdue { background: var(--red-bg); }
table.data .cell-id { font-family: "Courier New", monospace; font-weight: 600; color: var(--navy-800); }
table.data .cell-name { font-weight: 500; }
table.data .cell-meta { color: var(--grey-500); font-size: .82rem; }
table.data .cell-actions { white-space: nowrap; }

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.status-pending   { background: var(--grey-100); color: var(--grey-700); border: 1px solid var(--grey-300); }
.status-progress  { background: #E6ECF5; color: var(--navy-800); }
.status-waiting   { background: var(--amber-bg); color: var(--amber); }
.status-completed { background: var(--green-bg); color: var(--green); }
.status-cancelled { background: var(--red-bg); color: var(--red); }
.status-approved  { background: var(--green-bg); color: var(--green); }
.status-rejected  { background: var(--red-bg); color: var(--red); }
.status-notified  { background: var(--navy-100); color: var(--navy-800); }
.status-assigned  { background: var(--green-bg); color: var(--green); }
.status-reviewed  { background: var(--navy-100); color: var(--navy-800); }

.priority-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
}
.priority-normal  { background: var(--grey-100); color: var(--grey-700); }
.priority-high    { background: var(--amber-bg); color: var(--amber); }
.priority-urgent  { background: var(--gold-bg); color: var(--gold); font-weight: 700; }

/* Inline action menu */
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-actions .btn { padding: 5px 10px; font-size: .78rem; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,45,82,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--white);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0; background: var(--white);
}
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-close {
  background: transparent; border: 0;
  font-size: 1.4rem; cursor: pointer;
  color: var(--grey-500);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  line-height: 1;
}
.modal-close:hover { background: var(--grey-100); color: var(--grey-900); }
.modal-body { padding: 20px; }
.modal-body .field { margin-bottom: 14px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--grey-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky; bottom: 0; background: var(--white);
}

/* Notice composer */
.notice-composer .form-grid { grid-template-columns: 1fr; gap: 12px; }
.notice-composer .field.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notice-composer .field.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* =============================================================
   RESPONSIVE
   ============================================================= */

/* Tablet & below */
@media (max-width: 900px) {
  .container { padding: 18px 14px 70px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field.span-2 { grid-column: 1; }
  .panel-header { flex-direction: column; align-items: stretch; }
  .panel-actions { justify-content: flex-end; }
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .notice-composer .field.row-3 { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 600px) {
  .header-inner { padding: 10px 14px; }
  .brand-text h1 { font-size: 1rem; }
  .brand-text p { font-size: .68rem; }
  .brand-mark { width: 36px; height: 36px; font-size: 19px; }
  .header-status { font-size: .72rem; padding: 4px 8px; }
  .tabs { padding: 0 2px; }
  .tab-btn { min-width: 90px; padding: 10px 6px 8px; }
  .tab-label { font-size: .76rem; }
  .tab-icon { font-size: 1rem; }

  .container { padding: 14px 10px 70px; }
  h2 { font-size: 1.25rem; }
  .form-card { padding: 18px 14px; border-radius: var(--r-md); }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .notice-card { padding: 14px; }
  .notice-title { font-size: 1rem; }
  .success-card { padding: 22px 16px; }
  .work-id { font-size: 1.2rem; }
  .periods-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-card { padding: 12px; }
  .summary-card .count { font-size: 1.6rem; }
  .summary-card .label { font-size: .72rem; }
  .admin-user .user-name { display: none; }
  table.data { font-size: .82rem; }
  table.data thead th, table.data tbody td { padding: 8px 10px; }
  .toast { bottom: 16px; }
}

/* Small mobile */
@media (max-width: 380px) {
  .brand-text p { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .periods-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}

/* Print */
@media print {
  .app-header, .app-footer, .form-actions, .panel-actions, .admin-nav, .admin-header { display: none; }
  body { background: white; }
  .container { max-width: 100%; padding: 0; }
  .notice-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .tab-panel { animation: none; }
}
