:root {
  color-scheme: light;
  --navy: #063a79;
  --deep: #032b5c;
  --blue: #0b5fa8;
  --cyan: #4fb7e8;
  --lime: #d2eb3a;
  --surface: #ffffff;
  --soft: #eef6fc;
  --line: #c8d9ea;
  --ink: #10233b;
  --muted: #5d7188;
  --danger: #b42318;
  --ok: #12715b;
  --shadow: 0 20px 50px rgba(3, 43, 92, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e7f0f9;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(3, 43, 92, 0.08), transparent 18rem),
    linear-gradient(145deg, #f8fbfe 0%, #eef6fc 48%, #e5eff8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100%, 1480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 34px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(163, 190, 218, 0.78);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.topbar img {
  display: block;
  width: 116px;
  height: auto;
  border-radius: 4px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(350px, 410px) minmax(0, 1fr);
  gap: clamp(18px, 2vw, 30px);
}

.auth-layout {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 68px);
}

.panel,
.preview-panel,
.auth-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(163, 190, 218, 0.78);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel,
.preview-panel,
.auth-card {
  padding: clamp(18px, 2.2vw, 28px);
}

.auth-card {
  width: min(100%, 440px);
}

.brand {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 190px;
  margin-bottom: 26px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(22, 130, 212, 0.3) 0%, transparent 38%),
    linear-gradient(145deg, var(--navy) 0%, var(--deep) 100%);
  border-radius: 10px;
  color: #fff;
  text-align: center;
}

.brand img {
  width: min(176px, 68%);
  height: auto;
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.brand small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

form,
.form-grid {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

label > span {
  color: #2d4662;
  font-size: 13px;
  font-weight: 700;
}

label > small,
.hint {
  color: var(--muted);
}

input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

input:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(11, 95, 168, 0.14);
  outline: 0;
}

input[type="file"] {
  height: auto;
  min-height: 48px;
  padding: 6px;
}

.crop-editor {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #f5f9fd, #edf6fc);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.crop-editor[disabled] {
  opacity: 0.52;
}

.crop-editor legend {
  padding: 0 8px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 750;
}

input[type="range"] {
  height: auto;
  padding: 0;
  background: transparent;
  border: 0;
  accent-color: var(--blue);
}

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 6px;
}

button {
  min-height: 40px;
  padding: 0 16px;
  background: linear-gradient(135deg, #1682d4, var(--blue) 45%, var(--navy));
  border: 0;
  border-radius: 8px;
  box-shadow: 0 9px 18px rgba(3, 43, 92, 0.2);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button.secondary {
  background: #e5f1fb;
  border: 1px solid #c8dff3;
  box-shadow: none;
  color: var(--navy);
}

button.danger {
  background: #fff1f0;
  border: 1px solid #f2b8b5;
  box-shadow: none;
  color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid #dce7f3;
}

.status {
  padding: 6px 11px;
  background: #e6f2fb;
  border: 1px solid #c7dcf3;
  border-radius: 999px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.status.bad {
  background: #fff1f0;
  border-color: #f2b8b5;
  color: var(--danger);
}

.status.ok {
  background: #ecfdf6;
  border-color: #b7ead7;
  color: var(--ok);
}

.signature-shell {
  width: min(760px, 100%);
  min-height: 314px;
  padding: 20px;
  overflow: auto;
  background-color: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(3, 43, 92, 0.06);
}

iframe {
  display: block;
  width: 720px;
  height: 270px;
  background: transparent;
  border: 0;
}

.hidden {
  display: none !important;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.user-table th,
.user-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #dce7f3;
  text-align: left;
  vertical-align: middle;
}

.user-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 10px;
  }

  .topbar,
  .topbar-meta,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .signature-shell {
    padding: 14px;
  }

  .user-table {
    min-width: 720px;
  }

  .admin-scroll {
    overflow-x: auto;
  }
}
