:root {
  --brand-black: #0a0a0a;
  --brand-orange: #f07a00;
  --brand-orange-light: #ffb347;
  --brand-orange-dark: #c45c00;
  --brand-blue: #0077b6;
  --brand-blue-light: #48cae4;
  --bg: #fff8f3;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --text-on-dark: #ffffff;
  --accent: var(--brand-orange);
  --accent-dark: var(--brand-orange-dark);
  --accent-secondary: var(--brand-blue);
  --danger: #c62828;
  --danger-bg: #ffebee;
  --today: var(--brand-blue);
  --today-bg: #e3f2fd;
  --late: #b71c1c;
  --late-bg: #ffebee;
  --border: #e8ddd4;
  --chip-bg: #f3ebe3;
  --chip-active: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-light) 100%);
  --shadow: 0 2px 16px rgba(10, 10, 10, 0.08);
  --radius: 14px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --text: #f5f5f5;
    --text-muted: #a8a8a8;
    --border: #333;
    --chip-bg: #2a2520;
    --today-bg: #0d2137;
    --late-bg: #3d1515;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-logo--boot {
  width: min(240px, 72vw);
  margin-bottom: 16px;
}

.brand-logo--login {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  border-radius: 8px;
}

.brand-logo--header {
  width: auto;
  max-width: min(168px, 46vw);
  max-height: 56px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  mix-blend-mode: screen;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(72px + var(--safe-bottom));
}

.app--compact-bottom {
  padding-bottom: calc(16px + var(--safe-bottom));
}

.header {
  padding: 16px 16px 8px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header--brand {
  background: var(--brand-black);
  color: var(--text-on-dark);
  padding: calc(10px + var(--safe-top)) 12px 12px;
  margin-bottom: 4px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.header__logo-wrap {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  pointer-events: none;
}

.header--brand .icon-btn--menu {
  grid-column: 1;
}

.header--brand.header--sub {
  gap: 12px;
}

.header--brand .header__title--sub {
  flex: 1;
  text-align: center;
  margin-right: 48px;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--brand-orange-light);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.16);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--brand-blue-light);
  outline-offset: 2px;
}

.icon-btn__svg {
  display: block;
}

.header--sub {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header--brand .header__title {
  color: var(--brand-orange-light);
}

.page-title {
  margin: 0;
  padding: 12px 0 2px;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-orange);
  flex-shrink: 0;
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
  padding: 8px 0 12px;
  margin-bottom: 4px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.chip[aria-selected='true'] {
  background: var(--brand-orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(240, 122, 0, 0.35);
}

.chip[aria-selected='true'] .chip__count {
  color: rgba(255, 255, 255, 0.92);
}

.chip__count {
  display: inline-block;
  min-width: 1.25em;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.order-list,
.completed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card__open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}

.card__open:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.card--today {
  border-color: var(--today);
  background: var(--today-bg);
}

.card--late {
  border-color: var(--late);
  background: var(--late-bg);
}

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.card__name {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.card__date {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--brand-blue);
}

.card__date--muted {
  color: var(--text-muted);
  font-weight: 500;
}

.card__items {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card__status {
  flex: 1 1 140px;
  min-height: 44px;
  font-size: 1rem;
  font-family: inherit;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-light) 100%);
  color: #fff;
}

.btn--primary:active {
  background: var(--brand-orange-dark);
}

.btn--primary.btn--danger-fill {
  background: var(--danger);
}

.btn--secondary {
  background: var(--chip-bg);
  color: var(--text);
}

.btn--secondary.btn--blue {
  background: var(--brand-blue);
  color: #fff;
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn--block {
  width: 100%;
}

.btn-text {
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-text--on-dark {
  color: var(--brand-blue-light);
}

.btn-text:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 24%);
  pointer-events: none;
  z-index: 30;
}

.sidebar {
  position: fixed;
  inset: 0;
  z-index: 120;
  max-width: 480px;
  margin: 0 auto;
  pointer-events: none;
}

.sidebar:not([hidden]) {
  pointer-events: auto;
}

.sidebar__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  opacity: 0;
  transition: opacity 0.26s ease;
}

.sidebar--open .sidebar__backdrop {
  opacity: 1;
}

.sidebar__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(288px, 88vw);
  background: var(--brand-black);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 0 calc(12px + var(--safe-bottom));
  transform: translateX(-100%);
  transition: transform 0.26s ease;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  border-right: 3px solid var(--brand-orange);
}

.sidebar--open .sidebar__panel {
  transform: translateX(0);
}

.sidebar__head {
  padding: 8px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__logo {
  width: 120px;
  height: auto;
  display: block;
  object-fit: contain;
  background: transparent;
  mix-blend-mode: screen;
}

.sidebar__list {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
}

.sidebar__foot {
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__link {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid transparent;
}

.sidebar__link:hover,
.sidebar__link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar__link:focus-visible {
  outline: none;
  border-left-color: var(--brand-blue-light);
}

.sidebar__link--active {
  background: rgba(240, 122, 0, 0.12);
  border-left-color: var(--brand-orange);
  color: var(--brand-orange-light);
}

.sidebar__link--muted {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
}

.sidebar__link-label {
  flex: 1;
}

.sidebar__alerts {
  padding: 4px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
}

.sidebar__link-meta {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar__link[aria-pressed='true'] .sidebar__link-meta {
  color: var(--brand-orange-light);
}

.sidebar__hint {
  margin: 0;
  padding: 0 20px 8px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.5);
}

.btn--fab {
  width: 100%;
  pointer-events: auto;
  box-shadow: 0 4px 20px rgba(240, 122, 0, 0.35);
}

.state-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 16px;
}

.state-msg--error {
  color: var(--danger);
}

.login,
#login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: calc(24px + var(--safe-top));
}

.login--boot {
  gap: 8px;
}

#boot,
#login-screen:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--brand-black);
}

#login-screen:not([hidden]) {
  background: linear-gradient(180deg, var(--brand-black) 0%, #1a1208 40%, var(--bg) 40%);
}

.login__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.login__hint {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.login__card .field {
  text-align: left;
}

.field {
  display: block;
  margin-bottom: 16px;
  position: relative;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.875rem;
}

.field__optional {
  font-weight: 400;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}

.field__input:focus {
  outline: 2px solid var(--brand-orange);
  outline-offset: 0;
  border-color: var(--brand-orange);
}

.field__textarea {
  resize: vertical;
  min-height: 88px;
}

.field__error {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--danger);
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}

.suggestions li button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

.suggestions li button span {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sheet-backdrop:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  z-index: 100;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(24px + var(--safe-bottom));
  z-index: 101;
  border-top: 3px solid var(--brand-orange);
}

.sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 12px;
}

.sheet__title {
  margin: 0 0 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-orange-dark);
}

.sheet__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.sheet__actions .btn--primary {
  flex: 1;
}

.toast:not([hidden]) {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(88px + var(--safe-bottom));
  max-width: 448px;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--brand-black);
  color: #fff;
  border-radius: var(--radius);
  border-left: 4px solid var(--brand-orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 200;
  font-size: 0.9375rem;
}

.toast__action {
  color: var(--brand-blue-light);
  flex-shrink: 0;
}

.confirm:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.6);
}

.confirm__panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  border-top: 4px solid var(--brand-orange);
}

.confirm__title {
  margin: 0 0 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.confirm__message {
  margin: 0 0 20px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.confirm__actions {
  display: flex;
  gap: 10px;
}

.confirm__actions .btn {
  flex: 1;
}

.completed-row {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.completed-row__info {
  flex: 1;
  min-width: 0;
}

.completed-row__name {
  font-weight: 600;
  margin: 0 0 4px;
}

.completed-row__meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.completed-row__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.completed-row__open {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}

.completed-row__open:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.detail-list {
  margin: 0 0 8px;
  padding: 0;
}

.detail-list__row {
  margin-bottom: 14px;
}

.detail-list__row:last-child {
  margin-bottom: 0;
}

.detail-list__label {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detail-list__value {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  word-break: break-word;
}

.detail-list__value--pre {
  white-space: pre-wrap;
}

.sheet__actions--detail {
  flex-wrap: wrap;
}

.sheet__actions--detail .btn--secondary:first-child {
  flex: 1 1 100%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
