:root {
  --printer-ink: #20302c;
  --printer-green: #286558;
  --printer-green-soft: #e4efeb;
  --printer-border: #dce4e1;
  --printer-warm: #f6f3ed;
}

* { box-sizing: border-box; }
button, input, select { font: inherit; }
.printer-shell { padding-bottom: 64px; }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 6px; border-radius: 10px; background: rgba(40, 101, 88, .1); font-size: .72rem; }

.device-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: 28px 0 36px;
  padding: 24px 28px;
  color: #f8fbfa;
  background: linear-gradient(135deg, #173d36, #2d6257);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(24, 60, 53, .16);
}
.device-visual { display: grid; place-items: center; width: 112px; height: 92px; border-radius: 18px; background: rgba(255, 255, 255, .09); }
.device-visual svg { width: 84px; height: 64px; }
.device-visual .printer-top, .device-visual .printer-body { fill: #879692; }
.device-visual .printer-paper { fill: #f5f6f5; }
.device-visual .printer-slot { fill: #24332f; }
.device-visual circle { fill: #62d4a7; }
.eyebrow { margin: 0 0 7px; color: var(--printer-green); font-size: .72rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.device-copy .eyebrow { color: #a9d3c8; }
.device-copy h1 { margin: 0; font-family: var(--on-display-font); font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 500; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; color: #d1e1dc; font-size: .88rem; }
.status-line strong { color: white; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #a7b0ad; box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.status-dot.is-idle { background: #68d7a9; }
.status-dot.is-printing { background: #f4c968; animation: pulse 1.5s infinite; }
.status-dot.is-offline, .status-dot.is-unconfigured { background: #f18a7f; }
.alert-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.device-alert { padding: 4px 8px; color: #43251e; background: #f7cfc6; border-radius: 6px; font-size: .72rem; font-weight: 700; }
.device-meta { display: grid; grid-template-columns: repeat(3, minmax(88px, auto)); gap: 16px 22px; align-items: end; }
.device-meta div { display: grid; gap: 3px; }
.device-meta span { color: #a9c1ba; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.device-meta strong { font-size: .86rem; }
.toner-meter { width: 100%; height: 5px; overflow: hidden; background: rgba(255,255,255,.14); border-radius: 4px; }
.toner-meter b { display: block; height: 100%; background: #71d5ae; border-radius: inherit; transition: width .25s ease; }
.toner-meter b.is-low { background: #f1bf62; }
.quiet-button, .text-button { border: 0; cursor: pointer; }
.quiet-button { min-height: 38px; padding: 8px 14px; color: var(--printer-green); background: var(--printer-green-soft); border-radius: 10px; font-weight: 700; }
.device-meta .quiet-button { grid-column: 1 / -1; color: white; background: rgba(255,255,255,.12); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: reveal .22s ease-out; }
.compact-page-header { margin-bottom: 24px; }
.compact-page-header .on-page-title { max-width: 720px; }
.print-workspace { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(340px, .82fr); gap: 24px; align-items: start; }
.upload-card, .settings-card { padding: 22px; border: 1px solid var(--printer-border); box-shadow: 0 12px 34px rgba(44, 65, 59, .06); }
.drop-zone { display: grid; place-items: center; min-height: 158px; padding: 28px; border: 1.5px dashed #a8bbb5; border-radius: 17px; background: #f7faf9; cursor: pointer; text-align: center; transition: .18s ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--printer-green); background: #eef6f3; transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone strong { margin: 10px 0 4px; color: var(--printer-ink); font-size: 1rem; }
.drop-icon { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--printer-green); border-radius: 13px; font-size: 1.4rem; }
.upload-progress { display: flex; align-items: center; gap: 10px; padding: 13px; color: var(--printer-green); font-size: .82rem; }
.upload-progress i { width: 14px; height: 14px; border: 2px solid #bdd0ca; border-top-color: var(--printer-green); border-radius: 50%; animation: spin .8s linear infinite; }
.document-preview { position: relative; display: grid; place-items: center; min-height: 420px; margin-top: 18px; overflow: hidden; border-radius: 16px; background: #e7ebe9; }
.document-preview iframe { width: 100%; height: 540px; border: 0; background: white; }
.document-preview img { max-width: 100%; max-height: 540px; object-fit: contain; }
.preview-empty { color: #71807c; text-align: center; }
.preview-empty span { font-size: 3rem; opacity: .42; }
.preview-empty p { margin: 8px 0; font-size: .85rem; }
.document-preview:not(.is-empty) .preview-empty { display: none; }
.document-summary { align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.document-summary:not([hidden]) { display: flex; }
.document-summary div { display: grid; min-width: 0; gap: 4px; }
.document-summary strong { overflow: hidden; color: var(--printer-ink); text-overflow: ellipsis; white-space: nowrap; }
.document-summary span { color: #71807c; font-size: .76rem; }
.text-button { padding: 5px; color: var(--printer-green); background: transparent; font-weight: 700; }

.settings-card { position: sticky; top: 18px; }
.card-heading, .section-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.card-heading h3 { margin: 0; color: var(--printer-ink); font-family: var(--on-display-font); font-size: 1.55rem; font-weight: 500; }
.setting-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; color: #4a5d57; background: #edf1ef; border-radius: 8px; font-size: .7rem; font-weight: 700; }
.setting-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 22px; }
.form-grid label { display: grid; gap: 7px; }
.form-grid label > span { color: #52625e; font-size: .75rem; font-weight: 700; }
.setting-label { display: flex; align-items: center; gap: 7px; }
.setting-label svg { width: 16px; height: 16px; fill: none; stroke: var(--printer-green); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.form-grid input, .form-grid select, .search-box input { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--printer-ink); background: white; border: 1px solid #ccd8d4; border-radius: 10px; outline: 0; }
.form-grid input:focus, .form-grid select:focus, .search-box input:focus { border-color: var(--printer-green); box-shadow: 0 0 0 3px rgba(40,101,88,.1); }
.check-row { display: flex; gap: 11px; align-items: center; margin: 20px 0 10px; padding: 13px 14px; background: #f5f8f7; border-radius: 12px; cursor: pointer; }
.check-row input { accent-color: var(--printer-green); }
.check-row strong { color: var(--printer-ink); font-size: .82rem; }
.schedule-control { margin-bottom: 20px; }
.schedule-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; background: #f5f8f7; border-radius: 12px; cursor: pointer; }
.schedule-toggle > span { color: var(--printer-ink); font-size: .82rem; font-weight: 700; }
.schedule-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.schedule-toggle i { position: relative; width: 38px; height: 22px; background: #bdc9c5; border-radius: 12px; transition: .18s ease; }
.schedule-toggle i::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.18); content: ""; transition: .18s ease; }
.schedule-toggle input:checked + i { background: var(--printer-green); }
.schedule-toggle input:checked + i::after { transform: translateX(16px); }
.schedule-toggle input:focus-visible + i { box-shadow: 0 0 0 3px rgba(40,101,88,.16); }
.schedule-time { margin-top: 10px; padding: 13px 14px; background: #f8faf9; border: 1px solid var(--printer-border); border-radius: 12px; }
.schedule-time label { display: grid; gap: 7px; }
.schedule-time span { color: #52625e; font-size: .72rem; font-weight: 700; }
.schedule-time input { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--printer-ink); background: white; border: 1px solid #ccd8d4; border-radius: 10px; outline: 0; }
.schedule-time input:focus { border-color: var(--printer-green); box-shadow: 0 0 0 3px rgba(40,101,88,.1); }
.print-summary { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--printer-border); color: #71807c; font-size: .78rem; }
.print-summary strong { color: var(--printer-ink); text-align: right; }
.primary-print-button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 52px; margin-top: 8px; padding: 0 18px; color: white; background: var(--printer-green); border: 0; border-radius: 13px; cursor: pointer; font-weight: 750; box-shadow: 0 9px 20px rgba(40,101,88,.2); }
.primary-print-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.primary-print-button i { font-style: normal; font-size: 1.3rem; }
.form-feedback { min-height: 20px; margin: 10px 0 0; color: #b24d43; font-size: .78rem; }

.section-header { margin: 28px 0 20px; }
.section-header h2 { margin: 0; color: var(--printer-ink); font-family: var(--on-display-font); font-size: 2rem; font-weight: 500; }
.section-header > p { color: #71807c; font-size: .8rem; }
.search-box { min-width: min(300px, 100%); }
.record-list { display: grid; gap: 12px; }
.record-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px 19px; background: white; border: 1px solid var(--printer-border); border-radius: 15px; }
.record-icon { display: grid; place-items: center; width: 44px; height: 52px; color: var(--printer-green); background: var(--printer-green-soft); border-radius: 10px; font-weight: 800; }
.record-main { min-width: 0; }
.record-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-title strong { overflow: hidden; color: var(--printer-ink); text-overflow: ellipsis; white-space: nowrap; }
.record-main p { margin: 5px 0 0; color: #71807c; font-size: .76rem; }
.status-pill { flex: none; padding: 4px 7px; border-radius: 6px; font-size: .66rem; font-weight: 800; text-transform: capitalize; }
.status-pill--completed { color: #21614f; background: #dff1ea; }
.status-pill--failed, .status-pill--canceled { color: #98453d; background: #f7e4e1; }
.status-pill--scheduled { color: #315b74; background: #e2eff6; }
.status-pill--submitted, .status-pill--printing, .status-pill--processing, .status-pill--unknown { color: #796024; background: #f7edcf; }
.record-actions { display: flex; gap: 6px; }
.record-actions button { min-height: 34px; padding: 7px 10px; color: var(--printer-green); background: #eef5f2; border: 0; border-radius: 8px; cursor: pointer; font-size: .72rem; font-weight: 750; }
.record-actions button.danger { color: #a14b43; background: #f9ecea; }
.record-actions button.favorite-toggle { color: #8a641d; background: #fbf2d8; }
.empty-state { padding: 52px 24px; color: #71807c; background: rgba(255,255,255,.65); border: 1px dashed #becdc8; border-radius: 16px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--printer-ink); }

.favorites-section { margin-top: 48px; padding-top: 10px; border-top: 1px solid var(--printer-border); }
.favorites-header { margin-top: 28px; }
.favorite-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.favorite-card { display: grid; gap: 15px; padding: 20px; background: white; border: 1px solid var(--printer-border); border-radius: 16px; }
.favorite-card__top { display: flex; justify-content: space-between; gap: 12px; }
.favorite-card h3 { margin: 0; overflow: hidden; color: var(--printer-ink); font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.favorite-card p { margin: 6px 0 0; color: #71807c; font-size: .76rem; line-height: 1.45; }
.favorite-star { color: #c28b27; }
.favorite-meta { display: flex; justify-content: space-between; color: #71807c; font-size: .7rem; }
.favorite-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.favorite-actions button, .favorite-actions a { padding: 7px 9px; color: var(--printer-green); background: #eef5f2; border: 0; border-radius: 8px; cursor: pointer; font-size: .7rem; font-weight: 750; text-decoration: none; }

.favorite-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; overflow: hidden; color: var(--printer-ink); background: #fbfcfb; border: 1px solid rgba(40, 101, 88, .16); border-radius: 22px; box-shadow: 0 28px 80px rgba(24, 55, 49, .28); }
.favorite-dialog[open] { animation: dialog-in .18s ease-out; }
.favorite-dialog::backdrop { background: rgba(19, 39, 35, .52); backdrop-filter: blur(3px); }
.favorite-dialog__form { margin: 0; }
.favorite-dialog__header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 22px 24px 18px; border-bottom: 1px solid var(--printer-border); }
.favorite-dialog__header .eyebrow { margin-bottom: 3px; }
.favorite-dialog__header h2 { margin: 0; font-family: var(--on-display-font); font-size: 1.65rem; font-weight: 500; }
.favorite-dialog__icon { display: grid; place-items: center; width: 42px; height: 42px; color: #9a6d19; background: #fbf1d3; border-radius: 13px; font-size: 1.15rem; }
.favorite-dialog__close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: #62726d; background: #edf2f0; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.favorite-dialog__close:hover { color: var(--printer-ink); background: #e2ebe7; }
.favorite-dialog__fields { display: grid; gap: 18px; padding: 22px 24px 8px; }
.favorite-dialog__fields label { display: grid; gap: 7px; }
.favorite-dialog__fields label > span { color: #52625e; font-size: .76rem; font-weight: 750; }
.favorite-dialog__fields small { margin-left: 5px; color: #87938f; font-size: .68rem; font-weight: 500; }
.favorite-dialog__fields input, .favorite-dialog__fields textarea { width: 100%; padding: 11px 13px; color: var(--printer-ink); background: white; border: 1px solid #cbd8d3; border-radius: 11px; outline: 0; resize: vertical; }
.favorite-dialog__fields input:focus, .favorite-dialog__fields textarea:focus { border-color: var(--printer-green); box-shadow: 0 0 0 3px rgba(40, 101, 88, .1); }
.favorite-dialog__fields textarea { min-height: 116px; line-height: 1.45; }
.favorite-dialog__feedback { min-height: 20px; margin: 5px 24px 0; color: #a94d44; font-size: .76rem; }
.favorite-dialog__actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px 22px; }
.favorite-dialog__actions button { min-height: 42px; padding: 9px 16px; border: 0; border-radius: 11px; cursor: pointer; font-size: .78rem; font-weight: 750; }
.dialog-secondary { color: #52625e; background: #eaf0ed; }
.dialog-primary { color: white; background: var(--printer-green); box-shadow: 0 8px 18px rgba(40, 101, 88, .18); }
.dialog-primary:disabled { cursor: wait; opacity: .55; box-shadow: none; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(390px, calc(100vw - 44px)); padding: 12px 16px; color: white; background: #173d36; border-radius: 11px; box-shadow: 0 12px 34px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #8f433d; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(244,201,104,.05); } }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 900px) {
  .device-card { grid-template-columns: 86px 1fr; }
  .device-visual { width: 86px; height: 78px; }
  .device-meta { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
  .device-meta .quiet-button { grid-column: auto; }
  .print-workspace { grid-template-columns: 1fr; }
  .settings-card { position: static; }
  .favorite-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .printer-shell { padding-left: 14px; padding-right: 14px; }
  .device-card { grid-template-columns: 64px 1fr; gap: 14px; padding: 19px; border-radius: 18px; }
  .device-visual { width: 64px; height: 64px; }
  .device-visual svg { width: 56px; }
  .device-meta { grid-template-columns: 1fr 1fr; }
  .device-meta .quiet-button { grid-column: 1 / -1; }
  .upload-card, .settings-card { padding: 16px; }
  .document-preview { min-height: 300px; }
  .document-preview iframe { height: 420px; }
  .form-grid { grid-template-columns: 1fr; }
  .record-card { grid-template-columns: auto minmax(0, 1fr); }
  .record-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .section-header { align-items: flex-start; flex-direction: column; }
  .favorite-grid { grid-template-columns: 1fr; }
  .favorite-dialog__header, .favorite-dialog__fields { padding-left: 18px; padding-right: 18px; }
  .favorite-dialog__actions { padding-left: 18px; padding-right: 18px; }
}
