:root {
  --bg-main: #0f0f11;
  --bg-card-dark: linear-gradient(165deg, rgba(22, 22, 24, 0.98), rgba(35, 17, 15, 0.96));
  --bg-card-light: #fffaf6;
  --workspace-bg: #f3f5f1;
  --sidebar-green: #1f4d3a;
  --sidebar-green-dark: #173a2b;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --bg-soft: rgba(255, 255, 255, 0.06);
  --bg-soft-strong: rgba(255, 255, 255, 0.1);
  --text-light: #f8f2ec;
  --text-muted: rgba(248, 242, 236, 0.72);
  --text-dark: #241a16;
  --text-soft: #6b5d56;
  --text-faint: #8e7d74;
  --red-main: #b8202c;
  --red-dark: #88131d;
  --green-badge: #3cc174;
  --amber-soft: #fff0c8;
  --amber-border: #f3d68a;
  --amber-text: #7a5711;
  --border-dark: rgba(255, 255, 255, 0.08);
  --border-light: #e4d8cf;
  --shadow-card: 0 30px 70px rgba(0, 0, 0, 0.35);
  --shadow-panel: 0 18px 34px rgba(19, 15, 13, 0.08);
  --radius-xl: 34px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--text-light);
  background:
    radial-gradient(circle at top left, rgba(184, 32, 44, 0.18), transparent 24%),
    radial-gradient(circle at right center, rgba(184, 32, 44, 0.1), transparent 26%),
    linear-gradient(145deg, #0c0c0e, #131214 58%, #1d100f);
}

body.app-active {
  background: var(--workspace-bg);
  color: var(--text-dark);
  overflow-x: hidden;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.layout-card {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 0;
  border-radius: 38px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-panel {
  padding: 40px;
  background: var(--bg-card-dark);
  border-right: 1px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  min-height: 700px;
  position: relative;
}

.brand-panel::after {
  content: '';
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(184, 32, 44, 0.24), transparent 70%);
  pointer-events: none;
}

.brand-badge {
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(60, 193, 116, 0.14);
  color: #a7f0c6;
  border: 1px solid rgba(60, 193, 116, 0.32);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-copy {
  margin-top: 48px;
  max-width: 520px;
}

.brand-kicker,
.panel-kicker,
.card-label {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-kicker {
  color: rgba(248, 242, 236, 0.58);
}

.brand-panel h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.1rem);
  line-height: 0.94;
}

.brand-panel h1 span {
  color: #da3642;
}

.brand-description {
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.8;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 40px;
}

.mini-status-card {
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--border-dark);
  backdrop-filter: blur(12px);
}

.mini-status-card strong {
  display: block;
  margin: 0 0 6px;
  font-size: 1rem;
}

.mini-status-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-bottom: 14px;
  border-radius: 50%;
}

.status-dot.api {
  background: #ff5d6b;
}

.status-dot.db {
  background: #f0c34f;
}

.status-dot.https {
  background: #3cc174;
}

.brand-footer {
  margin-top: auto;
  padding-top: 32px;
  color: rgba(248, 242, 236, 0.58);
  font-size: 0.92rem;
}

.content-panel {
  background: var(--bg-card-light);
  color: var(--text-dark);
  padding: 40px;
  display: flex;
  align-items: center;
}

.panel-view {
  width: 100%;
}

.panel-header {
  margin-bottom: 26px;
}

.panel-kicker {
  color: var(--red-main);
}

.panel-header h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.panel-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

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

.field {
  display: grid;
  gap: 9px;
}

.field span {
  font-weight: 700;
}

.field input {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  font: inherit;
  color: var(--text-dark);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  font: inherit;
  color: var(--text-dark);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--red-main);
  box-shadow: 0 0 0 4px rgba(184, 32, 44, 0.12);
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--red-main), var(--red-dark));
  box-shadow: 0 16px 26px rgba(184, 32, 44, 0.22);
}

.secondary-button {
  padding: 14px 18px;
  color: #fff;
  background: #1d1715;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.message {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  line-height: 1.55;
}

.message.error {
  background: #fde8eb;
  color: #901927;
  border: 1px solid #f4c1c8;
}

.message.success {
  background: #e9f7ef;
  color: #16643a;
  border: 1px solid #b5e0c4;
}

.notice-box {
  margin-top: 20px;
  padding: 18px 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber-text);
}

.notice-box strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.notice-box p {
  margin: 0;
  line-height: 1.6;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--workspace-bg);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 22px;
  background: linear-gradient(180deg, var(--sidebar-green), var(--sidebar-green-dark));
  color: #f5fbf7;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.workspace-brand h2 {
  margin: 0 0 10px;
  font-size: 1.65rem;
}

.workspace-brand p {
  margin: 0;
  color: rgba(245, 251, 247, 0.76);
  line-height: 1.65;
}

.workspace-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(245, 251, 247, 0.58);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--sidebar-border);
}

.user-initial {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 1.1rem;
  font-weight: 800;
}

.user-card strong {
  display: block;
  font-size: 0.98rem;
}

.user-card p {
  margin: 4px 0 0;
  color: rgba(245, 251, 247, 0.74);
  font-size: 0.92rem;
}

.workspace-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  background: transparent;
  color: rgba(245, 251, 247, 0.82);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  outline: none;
  transform: translateX(2px);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-logout {
  margin-top: auto;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-logout:hover,
.sidebar-logout:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.main-content {
  padding: 30px;
  background: var(--workspace-bg);
  min-width: 0;
}

.workspace-view {
  width: 100%;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.workspace-header h2 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.08;
  color: var(--text-dark);
}

.workspace-overline {
  margin: 0 0 8px;
  color: #587064;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.workspace-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card,
.content-card {
  background: #ffffff;
  border: 1px solid #e5ddd5;
  border-radius: 22px;
  box-shadow: var(--shadow-panel);
}

.summary-card {
  padding: 20px;
}

.summary-label {
  margin: 0 0 14px;
  color: #6d8076;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dark);
  font-size: 2rem;
}

.summary-card span {
  display: block;
  color: var(--text-soft);
  line-height: 1.55;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.content-card {
  padding: 22px;
}

.card-heading {
  margin-bottom: 18px;
}

.card-heading h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-dark);
}

.placeholder-list,
.stock-alert-list {
  display: grid;
  gap: 12px;
}

.placeholder-item,
.alert-item {
  padding: 16px;
  border-radius: 18px;
  background: #f8f6f2;
  border: 1px solid #ebe3da;
}

.placeholder-item strong,
.alert-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.placeholder-item p,
.alert-item p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.alert-item.low-stock {
  background: #fff6df;
  border-color: #efd89f;
}

.toolbar-button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  background: var(--sidebar-green);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toolbar-button:hover,
.toolbar-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.toolbar-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-button-muted {
  background: #d8ddd8;
  color: #52625a;
}

.toolbar-button:disabled,
.toolbar-button-muted:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.state-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-panel);
}

.state-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.state-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.state-error {
  background: #fff5f6;
  border-color: #f0c7cd;
}

.inline-loader {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid rgba(184, 32, 44, 0.18);
  border-top-color: var(--red-main);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.materials-table-wrapper {
  margin-top: 4px;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: #fff;
  box-shadow: var(--shadow-panel);
}

.materials-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.materials-table th,
.materials-table td {
  padding: 16px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #efe2d9;
}

.materials-table th {
  font-size: 0.79rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: #fff8f3;
}

.materials-table td {
  color: var(--text-dark);
  font-size: 0.96rem;
}

.materials-table tbody tr:last-child td {
  border-bottom: 0;
}

.materials-table tbody tr:hover {
  background: #fffaf7;
}

.material-code {
  font-weight: 800;
  color: var(--red-dark);
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.status-badge.ok {
  background: #f3f0ec;
  color: #6b5d56;
}

.status-badge.low {
  background: #fff0c8;
  color: #8b5d0a;
}

.status-badge.inactive {
  background: #f3d8dc;
  color: #8a1c28;
}

.action-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #eef3ef;
  color: var(--sidebar-green);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.action-button:hover,
.action-button:focus-visible {
  background: #e1ebe4;
  transform: translateY(-1px);
  outline: none;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf1ec;
  color: #54665d;
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-comment-card {
  margin-bottom: 16px;
}

.detail-comment-text {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.summary-grid-detail {
  margin-bottom: 16px;
}

.form-card {
  padding: 24px;
}

.entry-form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-wide {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .page-shell {
    padding: 24px;
  }

  .layout-card {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border-dark);
  }

  .content-panel {
    padding-top: 30px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--sidebar-border);
    min-height: auto;
    position: static;
  }

  .summary-grid,
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .brand-panel,
  .content-panel {
    padding: 24px;
  }

  .sidebar {
    padding: 22px 18px;
  }

  .status-row,
  .summary-grid,
  .content-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    flex-direction: column;
  }

  .state-card {
    padding: 16px;
  }

  .main-content {
    padding: 20px;
  }
}
