*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e0e4ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --expired-bg: #fef2f2;
  --expired-border: #fca5a5;
  --red-bg: #fff1f0;
  --red-border: #fca5a5;
  --orange-bg: #fff7ed;
  --orange-border: #fdba74;
  --yellow-bg: #fefce8;
  --yellow-border: #fde047;
  --ok-bg: #f0fdf4;
  --ok-border: #86efac;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card button[type="submit"] { margin-top: .5rem; }
.login-footer { text-align: center; margin-top: 1rem; font-size: .8rem; color: var(--text-muted); }
.login-footer a { color: var(--primary); text-decoration: none; }
.nav-user { font-size: .85rem; color: var(--text-muted); }

/* Navbar */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: .75rem 1.5rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-shop { color: var(--text-muted); font-size: .85rem; flex: 1; }
.nav-links { display: flex; align-items: center; gap: .75rem; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: .875rem; padding: .25rem .5rem; border-radius: 4px; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: #eff6ff; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

/* Cards */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; box-shadow: var(--shadow); }
.card-num { font-size: 2rem; font-weight: 700; }
.card-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.card-expired { border-color: var(--expired-border); background: var(--expired-bg); }
.card-expired .card-num { color: var(--danger); }
.card-red { border-color: var(--red-border); background: var(--red-bg); }
.card-red .card-num { color: #c0392b; }
.card-orange { border-color: var(--orange-border); background: var(--orange-bg); }
.card-orange .card-num { color: #d97706; }
.card-yellow { border-color: var(--yellow-border); background: var(--yellow-bg); }
.card-yellow .card-num { color: #a16207; }
.card-ok { border-color: var(--ok-border); background: var(--ok-bg); }
.card-ok .card-num { color: #16a34a; }

/* Card panel */
.card-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.card-panel h2 { margin-bottom: 1rem; font-size: 1.1rem; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.section-header h2 { font-size: 1.1rem; }

/* Filter tabs */
.filter-tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.tab { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: .25rem .75rem; cursor: pointer; font-size: .8rem; color: var(--text-muted); }
.tab.active, .tab:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Table */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: .6rem .75rem; text-align: left; font-size: .8rem; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); font-size: .875rem; }
tr:last-child td { border-bottom: none; }
tr.row-expired { background: var(--expired-bg); }
tr.row-red { background: var(--red-bg); }
tr.row-orange { background: var(--orange-bg); }
tr.row-yellow { background: var(--yellow-bg); }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.badge-expired { background: #fca5a5; color: #7f1d1d; }
.badge-red { background: #fca5a5; color: #7f1d1d; }
.badge-orange { background: #fdba74; color: #7c2d12; }
.badge-yellow { background: #fde047; color: #713f12; }
.badge-ok { background: #86efac; color: #14532d; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .8rem; font-weight: 500; color: var(--text-muted); }
.full-span { grid-column: 1 / -1; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="file"], select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: .45rem .65rem; font-size: .875rem; width: 100%; background: var(--surface); color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px #bfdbfe; }
.inline-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-row input { flex: 1; min-width: 120px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .45rem 1rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: .875rem; font-weight: 500; transition: background .15s; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.full-width { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Messages */
.msg { padding: .6rem .9rem; border-radius: 6px; font-size: .875rem; }
.msg.success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.msg.error { background: var(--expired-bg); color: #991b1b; border: 1px solid var(--expired-border); }
.error-msg { padding: .5rem .75rem; background: var(--expired-bg); color: #991b1b; border: 1px solid var(--expired-border); border-radius: 6px; font-size: .875rem; }
.hidden { display: none !important; }
.loading, .empty { padding: 1.5rem; text-align: center; color: var(--text-muted); }
.hint { font-size: .8rem; color: var(--text-muted); margin-top: .5rem; }
.mt-1 { margin-top: 1rem; }

/* Result panel */
.result-panel { background: #f0fdf4; border: 1px solid #86efac; border-radius: var(--radius); padding: 1rem; margin-top: 1rem; }
.result-panel ul { margin: .5rem 0 .5rem 1.2rem; }
.success-text { color: #166534; font-weight: 500; margin-bottom: .5rem; }

/* Warning button */
.btn-warn { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.btn-warn:hover { background: #ffedd5; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.18); width: 100%; max-width: 680px; max-height: 85vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 0 .25rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1rem 1.25rem; overflow-y: auto; flex: 1; }
.modal-body .hint { margin-bottom: .75rem; }
.modal-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }
