.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; } .card h3 { margin-bottom: .6em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.hero-card { position: relative; overflow: hidden; padding: 26px; border-radius: 22px; background: radial-gradient(900px 300px at 100% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 60%), linear-gradient(135deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-2); }
.hero-card h2 { font-size: clamp(1.4rem, 3vw, 2rem); } .hero-card p { color: var(--muted); max-width: 60ch; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .92rem; transition: transform .12s, background .15s, border-color .15s; text-decoration: none !important; }
.btn:hover { border-color: var(--accent); } .btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); } .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.ghost { background: transparent; } .btn.sm { padding: 6px 11px; font-size: .82rem; border-radius: 10px; } .btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.field { display: grid; gap: 6px; font-size: .84rem; color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); }
body.diy-mode input, body.diy-mode select, body.diy-mode textarea { background: #fffdf8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { min-height: 86px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .form-grid .full { grid-column: 1 / -1; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--bg); }
.choice input { width: auto; margin-top: 4px; } .choice label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.choice b { display: block; } .choice small { color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: .8rem; font-weight: 600; }
button.chip:hover { color: var(--text); border-color: var(--accent); } .chip.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--line-2); color: var(--muted); }
.tag.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.tag.conditional { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.tag.restricted, .tag.critical { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
body.diy-mode .tag.conditional { color: #a16207; } body.diy-mode .tag.good { color: #15803d; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 800; display: inline-grid; place-items: center; }

.stat { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat small { color: var(--muted); display: block; } .stat strong { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; display: block; } .stat em { font-style: normal; color: var(--faint); font-size: .8rem; }

.status { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 700; text-transform: capitalize; background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.status.s-quoted, .status.s-reviewing { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.status.s-approved, .status.s-in_production, .status.s-quality_check { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: color-mix(in srgb, var(--accent-2) 60%, var(--text)); }
.status.s-ready_for_dispatch, .status.s-dispatched { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.status.s-delivered { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.status.s-cancelled, .status.s-rejected { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.ticket { display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.ticket h4 { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ticket .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; }
.ticket .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ticket-list { display: grid; gap: 12px; }
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; height: 120px; }
.pipeline div { display: grid; align-content: end; gap: 5px; text-align: center; font-size: .66rem; color: var(--muted); height: 100%; }
.pipeline i { display: block; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); min-height: 4px; }
.timeline { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: .84rem; }
.timeline li { padding-left: 16px; position: relative; color: var(--muted); } .timeline li::before { content: ''; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.note { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--info) 8%, transparent); font-size: .88rem; }
.note.red { background: color-mix(in srgb, var(--bad) 9%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.note.green { background: color-mix(in srgb, var(--good) 9%, transparent); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.note.amber { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: .9rem; pointer-events: none; transition: .25s; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); opacity: 1; } .toast.bad { background: var(--bad); color: #fff; }

dialog { border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text); padding: 0; width: min(94vw, 460px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 6, 23, .6); backdrop-filter: blur(4px); }
.dialog-body { padding: 24px; display: grid; gap: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg); border-radius: 12px; }
.tabs button { padding: 8px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; color: var(--muted); } .tabs button.on { background: var(--surface-2); color: var(--text); }
.role-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-pick label { display: grid; gap: 2px; padding: 10px 6px; text-align: center; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; font-size: .82rem; background: var(--bg); }
.role-pick input { display: none; } .role-pick label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); } .role-pick .i { margin: 0 auto; width: 1.6em; height: 1.6em; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; } .tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; } .tbl th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.notif-panel { position: absolute; right: 0; top: 46px; width: min(92vw, 340px); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 10px; display: grid; gap: 6px; z-index: 40; }
.notif-panel .n { padding: 10px; border-radius: 10px; font-size: .85rem; background: var(--bg); } .notif-panel .n.unread { border-left: 3px solid var(--accent); }
.rel { position: relative; }
