/* Zetrik Theme - License Panel (Apple System Settings jaisa, halka, aankhon ko aaram) */
:root {
  --bg: #f3f5f9; --card: #ffffff; --side: #fbfbfd; --line: #e2e5eb; --line2: #eef0f4;
  --text: #1d1d1f; --muted: #55585e; --blue: #0a66d6; --blue-soft: #e8f1fc;
  --green: #1f7a37; --green-bg: #e6f4ea; --red: #b3261e; --red-bg: #fbe9e7;
  --amber: #955200; --amber-bg: #fdf1e0; --grey: #5f6368; --grey-bg: #eef0f3;
  --switch: #34c759; --radius: 14px; --font: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #9cc3f5; outline-offset: 1px; }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.brand.center { justify-content: center; padding-bottom: 22px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a, .side .out { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.side nav a:hover, .side .out:hover { background: #eceef2; text-decoration: none; }
.side nav a.on { background: var(--blue); color: #fff; }
.tile { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.tile svg { width: 15px; height: 15px; }
.tile.blue { background: #0a84ff; } .tile.green { background: #30a14e; } .tile.indigo { background: #5856d6; }
.tile.orange { background: #f08c00; } .tile.purple { background: #9b51e0; } .tile.teal { background: #149aa6; }
.tile.pink { background: #e0457b; } .tile.red { background: #e5484d; } .tile.grey { background: #8e8e93; } .tile.slate { background: #5b6b7f; }
.side nav a.on .tile { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(243,245,249,.9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.top h1 { font-size: 21px; flex: 1; }
.top .who { color: var(--muted); font-weight: 500; }
.menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1280px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.card > h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card > h2 .right { margin-left: auto; font-weight: 400; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 18px 22px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat b { display: block; font-size: 24px; margin-top: 4px; font-weight: 600; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.bar .grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .empty { text-align: center; color: var(--muted); padding: 30px; }
.table a.name { font-weight: 600; }

/* Key-value */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: #3a3c40; }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid #cfd4dc; border-radius: 10px; padding: 9px 12px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2355585e' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; border-radius: 999px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* Apple green switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 44px; height: 26px; border-radius: 999px; background: #d1d4da; position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked + i { background: var(--switch); }
.switch input:checked + i::after { left: 21px; }
.switch input:focus-visible + i { outline: 3px solid #9cc3f5; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfd4dc; background: #fff; color: var(--text); font: inherit; font-weight: 500; padding: 8px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f5f6f8; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #0857b8; }
.btn.danger { color: var(--red); border-color: #e7b8b4; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 12px; font-size: 13.5px; }
.inline { display: inline; }

/* Badges - rang ke saath label hamesha */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.grey { background: var(--grey-bg); color: var(--grey); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.alert.ok { background: var(--green-bg); color: var(--green); border-color: #bfe3c8; }
.alert.err { background: var(--red-bg); color: var(--red); border-color: #f0c5c0; }
.alert.warn { background: var(--amber-bg); color: var(--amber); border-color: #f2d5a8; }

/* Tabs */
.tabs { display: inline-flex; gap: 4px; background: #e6e9ee; padding: 4px; border-radius: 999px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--text); font-weight: 500; font-size: 14px; }
.tabs a:hover { text-decoration: none; background: rgba(255,255,255,.6); }
.tabs a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.pager { display: flex; gap: 6px; padding: 14px; flex-wrap: wrap; }
.pager a { padding: 4px 11px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); }
.pager a.on { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Module limits box */
.mod-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.mod-box .limits { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mod-box .limits .field { width: 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--grey-bg); border-radius: 999px; padding: 2px 10px; font-size: 13px; }

/* Items table in invoice form */
.items input { padding: 7px 9px; }
.items td { padding: 6px; }
.totals { margin-left: auto; width: 320px; max-width: 100%; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }

/* Login */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px; width: 400px; max-width: 100%; }
.login-box .field { margin-bottom: 14px; }
.login-box .btn { width: 100%; justify-content: center; }

/* Document (invoice) preview */
.doc-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-frame iframe { width: 100%; height: 1100px; border: 0; display: block; }

@media (max-width: 900px) {
  .side { position: fixed; left: -260px; z-index: 20; transition: left .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
  body.nav-open .side { left: 0; }
  .menu-btn { display: inline-flex; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .kv { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.center { text-align: center; }
