:root {
  color-scheme: dark;
  --page: #10171d;
  --surface: #15202a;
  --surface-soft: #18242e;
  --line: #334755;
  --line-soft: #293b47;
  --text: #edf0f2;
  --muted: #91a0aa;
  --orange: #ff9a4d;
  --orange-pressed: #ed8740;
  --orange-soft: rgba(255, 154, 77, .12);
  --danger: #ff8d82;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--page); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 370px); display: grid; gap: 16px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 20px 70px rgba(0, 0, 0, .3); }
.login-card h1 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.login-card > p { margin: -8px 0 4px; color: var(--muted); font-size: 13px; }

label { display: grid; gap: 7px; }
label span { color: #b6c0c7; font-size: 13px; font-weight: 650; }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #111a21; color: var(--text); }
input, select { height: 46px; padding: 0 13px; }
select { appearance: none; -webkit-appearance: none; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff9a4d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-position: right 13px center; background-repeat: no-repeat; }
textarea { min-height: 105px; padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.primary { min-height: 44px; padding: 0 17px; border: 0; border-radius: 11px; background: var(--orange); color: #192028; font-weight: 800; }
.primary:active { background: var(--orange-pressed); transform: scale(.98); }
.primary:disabled { opacity: .55; cursor: wait; }
.message { min-height: 17px; color: var(--danger); font-size: 12px; line-height: 1.4; }

.app { width: min(100%, 960px); margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 22px max(40px, env(safe-area-inset-bottom)); }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.035em; }
.actions { display: flex; align-items: center; gap: 10px; }
.create { display: inline-flex; align-items: center; gap: 7px; }
.create span { font-size: 20px; font-weight: 500; line-height: 1; }
.logout { min-height: 40px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.content { padding-top: 18px; }
.page-message { display: block; margin: 0 0 10px; }
.tabs { display: flex; gap: 5px; width: max-content; margin-bottom: 13px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.tab { min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.tab span { margin-left: 4px; font-size: 11px; }
.tab.is-active { background: var(--orange-soft); color: var(--orange); }
.restriction-list { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.restriction { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(210px, 1.7fr) auto auto; align-items: center; gap: 12px; min-height: 57px; padding: 9px 10px 9px 13px; border-bottom: 1px solid var(--line-soft); }
.restriction:last-child { border-bottom: 0; }
.restriction h2 { margin: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.3; }
.restriction p { margin: 0; color: #c8d0d5; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.limit-badge { min-width: 72px; padding: 5px 8px; border-radius: 8px; background: var(--orange-soft); color: var(--orange); font-size: 12px; font-weight: 800; text-align: center; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 5px; }
.zone-badge { padding: 5px 8px; border-radius: 8px; background: rgba(145, 160, 170, .09); color: #aeb9c0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.restriction time { min-width: 100px; color: var(--orange); font-size: 12px; font-weight: 750; text-align: right; white-space: nowrap; }
.restriction.is-archive { opacity: .7; }
.restriction.is-archive .limit-badge, .restriction.is-archive .zone-badge, .restriction.is-archive time { color: var(--muted); background: rgba(145, 160, 170, .08); }
.delete-button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.delete-button.is-confirming { border-color: rgba(255, 141, 130, .55); background: rgba(255, 141, 130, .08); color: var(--danger); }
.resolve-button { border-color: rgba(255, 154, 77, .42); color: var(--orange); }
.resolve-button.is-confirming { border-color: var(--orange); background: var(--orange-soft); color: var(--orange); }
.delete-button:disabled { opacity: .5; cursor: wait; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.edit-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; }
.edit-button:hover { border-color: rgba(255, 154, 77, .45); color: var(--orange); }
.empty { padding: 50px 20px; color: var(--muted); text-align: center; font-size: 13px; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3, 7, 10, .72); backdrop-filter: blur(6px); }
.modal { width: min(100%, 470px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 80px rgba(0, 0, 0, .48); }
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.modal form { display: grid; gap: 15px; }
.close { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 22px; }

@media (max-width: 700px) {
  .app { padding-inline: 15px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { padding-top: 8px; font-size: 23px; }
  .logout { display: none; }
  .tabs { width: 100%; }
  .tab { flex: 1 1 0; padding-inline: 6px; }
  .restriction { grid-template-columns: 1fr auto auto; gap: 6px 9px; min-height: 62px; padding: 9px 10px; }
  .restriction h2 { grid-column: 1; grid-row: 1; }
  .row-meta { grid-column: 2; grid-row: 1; }
  .limit-badge { min-width: 56px; }
  .zone-badge { padding-inline: 6px; }
  .restriction time { grid-column: 3; grid-row: 1; }
  .restriction p { grid-column: 1 / -1; grid-row: 2; }
  .row-actions { grid-column: 1 / -1; grid-row: 3; }
  .delete-button { width: max-content; min-height: 30px; padding-inline: 8px; }
  .edit-button { width: 30px; height: 30px; }
}

@media (max-width: 460px) {
  .create { min-height: 42px; padding-inline: 13px; }
  .modal-backdrop { place-items: end center; padding: 18px 0 0; }
  .modal { max-height: calc(100dvh - 18px); padding: 20px 17px max(24px, env(safe-area-inset-bottom)); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
