/* =========================================================
   css/components.css — Kad, jadual, badge, modal, toast, utiliti, tabs, list, graf, chip
   ========================================================= */
/* ---------------- Cards & layout ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem; margin-bottom: 1.2rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h3 { margin: 0; }

.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--navy-800), var(--blue-600));
  color: #e7eefb; border: 0; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(221,185,74,.18); }
.hero h2 { color: #fff; }
.hero p { color: #c7d5f0; margin: 0; }
.hero > * { position: relative; z-index: 1; }

.quick-grid, .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.quick { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--ink);
  margin: 0; transition: transform .15s, border-color .15s; }
.quick:hover { transform: translateY(-2px); border-color: var(--gold-400); }
.quick .ico { width: 28px; height: 28px; color: var(--blue-600); margin-bottom: .4rem; }
.stat { display: flex; align-items: center; gap: .9rem; margin: 0; }
.stat .ico { width: 44px; height: 44px; padding: 10px; border-radius: 12px;
  background: var(--blue-100); color: var(--blue-600); }
.stat:nth-child(even) .ico { background: var(--gold-100); color: var(--gold-600); }
.stat > div > span { display: block; font-size: .84rem; color: var(--ink-2); }
.stat strong { font-size: 1.6rem; color: var(--navy-800); }

.empty-state { text-align: center; padding: 2.4rem 1.3rem; }
.empty-icon { font-size: 2.4rem; margin-bottom: .4rem; }
.plan-list { display: inline-block; text-align: left; margin: .4rem 0 0; color: var(--ink-2); }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .7rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--blue-50); color: var(--navy-800); font-weight: 600; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover { background: #fafbfe; }

/* ---------------- Badge ---------------- */
.badge { display: inline-block; padding: .18em .65em; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #eef0f4; color: var(--ink-2); }
.badge-gold { background: var(--gold-100); color: var(--gold-600); }

/* ---------------- Modal ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 26, 58, .55);
  display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.2rem 1.3rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.3rem;
  border-top: 1px solid var(--line); background: var(--blue-50); border-radius: 0 0 16px 16px; }
@keyframes fade { from { opacity: 0; } }

/* ---------------- Toast ---------------- */
.toast-box { position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: .5rem; max-width: calc(100% - 32px); }
.toast { padding: .75rem 1rem; border-radius: 10px; color: #fff; background: var(--navy-800);
  box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s; border-left: 4px solid var(--gold-400); }
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-left-color: #4cd39a; }
.toast-error { border-left-color: #ff7a6b; }

/* ---------------- Utilities ---------------- */
.muted { color: var(--ink-3); }
.center { text-align: center; }
.right { text-align: right; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 1.2rem; }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }
.link-sm { font-size: .85rem; text-decoration: none; font-weight: 600; }
.section-title { margin: 1.4rem 0 .8rem; }
code { background: var(--blue-50); padding: .1em .4em; border-radius: 5px; font-size: .88em; }
.icon-btn.sm { width: 30px; height: 30px; font-size: .95rem; }
.note { margin-top: .35rem; font-size: .84rem; background: var(--gold-100); color: #6b5512;
  padding: .3rem .55rem; border-radius: 6px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar p { margin: 0; }
.toolbar .filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.toolbar .filters input, .toolbar .filters select { width: auto; min-width: 160px; }

.layout-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.layout-2.wide-left { grid-template-columns: 1.6fr 1fr; }
.layout-2 > .card, .layout-2 > div > .card:last-child { margin-bottom: 0; }
.layout-2 + * { margin-top: 1.2rem; }
.grid-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-cards > .card { margin: 0; }

.stat-sub { font-size: .8rem; color: var(--ink-2); margin-top: .15rem; }
.stat-sub .badge { font-size: .72rem; }
.stat strong small { font-size: .55em; color: var(--ink-3); font-weight: 600; }

/* Tabs (pill) */
.tabs { display: inline-flex; background: var(--blue-50); padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: .4rem .85rem; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.tab.active { background: #fff; color: var(--navy-800); box-shadow: 0 1px 3px rgba(11,42,91,.12); }

/* List */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list strong { display: block; font-size: .93rem; }
.date-box { width: 46px; text-align: center; border-radius: 10px; padding: .25rem 0;
  background: var(--blue-100); color: var(--navy-800); line-height: 1.1; flex-shrink: 0; }
.date-box b { display: block; font-size: 1.15rem; }
.date-box small { color: var(--blue-600); font-size: .72rem; text-transform: uppercase; }

/* Key-value */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0 0 .6rem; }
.kv dt { color: var(--ink-2); font-size: .88rem; }
.kv dd { margin: 0; }
.kv-inline { grid-template-columns: repeat(4, max-content 1fr); }

/* Chart */
.chart-box { position: relative; height: 280px; }
.chart-box p { padding-top: 110px; margin: 0; }

/* Chip checkbox */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: .32rem .7rem; border: 1px solid var(--line); border-radius: 99px;
  font-size: .84rem; color: var(--ink-2); background: #fff; }
.chip input:checked + span { background: var(--gold-100); border-color: var(--gold-500); color: #6b5512; font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid rgba(201,162,39,.45); }

/* Info card */
.info-card { display: flex; gap: 1rem; background: linear-gradient(120deg, #fff, var(--gold-100)); border-color: #eedfa9; }
.info-card p { color: var(--ink-2); }
.info-icon .ico { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--gold-500); color: #fff; }

/* Bar list */
.bar-list { list-style: none; padding: 0; margin: 0; }
.bar-list li { display: grid; grid-template-columns: 1fr 90px 32px; gap: .6rem; align-items: center;
  font-size: .87rem; padding: .3rem 0; }
.bar { height: 8px; background: var(--blue-50); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-400), var(--gold-500)); }
.bar-list b { text-align: right; color: var(--ink-2); }
