@font-face { font-family: Onest; font-weight: 400; src: url("/fonts/Onest-400.ttf"); font-display: swap; }
@font-face { font-family: Onest; font-weight: 500; src: url("/fonts/Onest-500.ttf"); font-display: swap; }
@font-face { font-family: Onest; font-weight: 600; src: url("/fonts/Onest-600.ttf"); font-display: swap; }
@font-face { font-family: Onest; font-weight: 700; src: url("/fonts/Onest-700.ttf"); font-display: swap; }

:root {
  --bg: #f4f3f1; --surface: #fff; --ink: #1c1c1e; --muted: #6e6e73; --line: #e5e3df; --soft: #f7f6f4;
  --accent: #b42318; --ok: #1f7a4d; --warn: #b26b00; --err: #b42318; --info: #2459b8;
  --r: 10px;
}
* { box-sizing: border-box; }
html { font-family: Onest, system-ui, sans-serif; font-size: 15px; color: var(--ink); background: var(--bg); }
body { margin: 0; line-height: 1.45; }
a { color: inherit; }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* tuzilma */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #f2f2f2; padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
.side .brand span { color: #ff8a80; }
.side nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px;
              text-decoration: none; color: #d6d6d6; font-size: 14px; }
.side nav a:hover { background: #2c2c2e; color: #fff; }
.side nav a.on { background: #fff; color: var(--ink); font-weight: 500; }
.side nav .sep { height: 1px; background: #333; margin: 10px 6px; }
.count { background: var(--accent); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 7px; font-weight: 600; }
.side form { margin-top: 18px; padding: 0 10px; }
.side .who { font-size: 13px; color: #a1a1a6; margin-bottom: 6px; }
.main { padding: 24px 28px 60px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.mobile-bar { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.side-by-side { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.side-by-side > *, .grid > * { min-width: 0; }

.stat .n { font-size: 26px; font-weight: 600; letter-spacing: -.3px; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .d { font-size: 13px; margin-top: 2px; }

/* tugmalar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
       background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 16px; font: 500 14px Onest, sans-serif;
       cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c9c6c0; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* formalar */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px; font-weight: 500; }
.field { margin-bottom: 14px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: 14px Onest, sans-serif;
  background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #1c1c1e22; border-color: #9a978f; }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-height: 520px; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label.check { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; }

/* jadval */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a.row-link { text-decoration: none; font-weight: 500; }
.table a.row-link:hover { text-decoration: underline; }
.num { text-align: right; white-space: nowrap; }

/* holat */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st.review::before, .st.pending::before { background: var(--warn); }
.st.approved::before { background: var(--info); }
.st.published::before, .st.paid::before { background: var(--ok); }
.st.failed::before, .st.rejected::before { background: var(--err); }
.st.generating::before, .st.queued::before, .st.publishing::before { background: #8e8e93; }

.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.flash.ok { background: #f1f8f4; border-color: #cfe7d9; color: #14532d; }
.flash.err { background: #fdf2f1; border-color: #f3cdc9; color: #7a1a12; }
.note { background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; white-space: pre-line; }
.note.err { background: #fdf2f1; color: #7a1a12; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.preview-img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.tabs { display: inline-flex; background: #e9e7e3; border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 14px; color: var(--muted); }
.tabs a.on { background: #fff; color: var(--ink); font-weight: 500; }
details.more summary { cursor: pointer; font-size: 14px; color: var(--muted); }
details.more[open] summary { margin-bottom: 10px; }

/* kalendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { padding: 8px; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.cal .day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.cal .day.out { background: var(--soft); color: #b0aea9; }
.cal .day.today .dn { background: var(--ink); color: #fff; border-radius: 6px; padding: 0 6px; }
.cal .dn { font-size: 13px; font-weight: 600; display: inline-block; margin-bottom: 4px; }
.cal .it { display: block; font-size: 12.5px; text-decoration: none; padding: 3px 5px; border-radius: 5px; margin-bottom: 3px;
           border: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .it:hover { border-color: #b9b6b0; }
.cal .it b { font-weight: 600; }

.verbs td { padding: 4px; }
.verbs input { padding: 6px 8px; font-size: 13px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .side-by-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  html { font-size: 15px; }
  .layout { display: block; }
  .side { display: none; position: static; height: auto; }
  .mobile-bar { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff;
                padding: 12px 16px; position: sticky; top: 0; z-index: 5; }
  .mobile-bar .brand { font-weight: 700; }
  .mobile-bar .brand span { color: #ff8a80; }
  .mobile-bar summary { list-style: none; cursor: pointer; border: 1px solid #555; border-radius: 999px; padding: 5px 14px; font-size: 14px; }
  .mobile-bar summary::-webkit-details-marker { display: none; }
  .mobile-bar details[open] .side { display: block; position: absolute; left: 0; right: 0; top: 52px; height: calc(100vh - 52px); }
  .main { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  /* jadval → kartochkalar: amal tugmalari ekrandan chiqib ketmasin */
  .table.stack thead { display: none; }
  .table.stack tr { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #fff; }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right; }
  .table.stack td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; }
  .table.stack td.num { white-space: normal; }
  .cal { grid-template-columns: 1fr; }
  .cal .dow, .cal .day.out { display: none; }
  .cal .day { min-height: 0; }
  .head { align-items: flex-start; }
}
