body {
  background: linear-gradient(180deg, #EFE6D8 0%, #E6DCCB 100%);
  color: #20180C;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100vh;
}

/* APP SHELL */

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* TOPBAR */

.topbar {
  height: 64px;
  border: 1px solid #D8CCB8;
  border-radius: 16px;
  background: linear-gradient(180deg, #FBF6EE 0%, #F2E8DA 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.tb-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.greeting {
  font-size: 12px;
  color: #8E816D;
}

.shopname {
  font-size: 16px;
  font-weight: 700;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tb-time {
  font-size: 12px;
  color: #6E6250;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #D4C6B2;
  background: linear-gradient(180deg, #F8F1E6 0%, #EFE5D6 100%);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #4B3E2C;
}

.tb-btn svg {
  width: 14px;
  height: 14px;
}

/* DASHBOARD */

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  border-radius: 16px;
  padding: 14px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.stat-label {
  font-size: 11px;
  opacity: 0.9;
}

.stat-val {
  font-size: 20px;
  font-weight: 800;
  margin-top: 6px;
}

.stat-ico {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  opacity: 0.25;
}

/* COLORS */

.s-blue {
  background: linear-gradient(180deg, #5A8DEE 0%, #3F6FDB 100%);
}

.s-green {
  background: linear-gradient(180deg, #56C271 0%, #3FA85C 100%);
}

.s-amber {
  background: linear-gradient(180deg, #F0B14A 0%, #D49A37 100%);
}

.s-coral {
  background: linear-gradient(180deg, #E36C6C 0%, #C94E4E 100%);
}

/* ACTIONS */

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

.act {
  height: 52px;
  border-radius: 14px;
  border: 1px solid #D6C8B6;
  background: linear-gradient(180deg, #F7F1E7 0%, #EEE5D6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: #3C2F1F;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.act .ico {
  width: 16px;
  height: 16px;
  display: flex;
}

.act svg {
  width: 100%;
  height: 100%;
}

.act:hover {
  filter: brightness(1.02);
}

.act.on {
  border-color: #C8943C;
  box-shadow: 0 0 0 2px rgba(200, 148, 60, 0.2);
}

/* WORKSPACE */

.workspace {
  flex: 1;
  border: 1px solid #D8CCB8;
  border-radius: 18px;
  background: linear-gradient(180deg, #FBF6EE 0%, #F3EBDD 100%);
  padding: 16px;
  overflow: hidden;
  position: relative;
}

/* MODULE ROOT */

#module-root {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

/* MODULE STATES */

.module-loading,
.module-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  text-align: center;
  padding: 24px;
  font-size: 14px;
  color: #7E725E;
}

.module-error {
  flex-direction: column;
  gap: 8px;
}

/* OVERLAY */

.overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #EFE6D8 0%, #E6DCCB 100%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* OVERLAY LOGO */

.ov-logo {
  text-align: center;
}

.ov-logo .shop {
  font-size: 22px;
  font-weight: 800;
}

.ov-logo .sub {
  font-size: 12px;
  color: #8E816D;
  margin-top: 4px;
}

/* CARD */

.ov-card {
  width: 400px;
  max-width: calc(100vw - 32px);
  border-radius: 18px;
  border: 1px solid #D6C8B6;
  background: linear-gradient(180deg, #FBF6EE 0%, #F2E8DA 100%);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.ov-title {
  font-size: 14px;
  font-weight: 700;
}

.ov-f {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ov-f label {
  font-size: 11px;
  color: #7C6F5D;
}

.ov-f input {
  height: 48px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid #D2C3AF;
  padding: 0 14px;
  font-size: 14px;
  background: #FBF7EF;
  outline: none;
}

.ov-f input:focus {
  border-color: #C8943C;
  box-shadow: 0 0 0 2px rgba(200, 148, 60, 0.15);
}

.ov-f input.err {
  border-color: #C94E4E;
}

/* ERROR */

.ov-err {
  display: none;
  font-size: 11px;
  color: #C94E4E;
}

/* BUTTON */

.ov-btn {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid #C8943C;
  background: linear-gradient(180deg, #F3D79E 0%, #E2C074 100%);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #5A3F10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

.ov-btn:hover {
  filter: brightness(1.02);
}

/* TOAST */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  z-index: 99999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  background: #4CAF50;
}

.toast.err {
  background: #E53935;
}

/* RESPONSIVE */

@media (max-width: 1000px) {
  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

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

  .ov-card {
    width: calc(100vw - 24px);
  }
}

/* ===== KOYU TEMA (global) ===== */
body.dark {
  background: linear-gradient(180deg, #1a1612 0%, #141210 100%);
  color: #e8dcc8;
}

body.dark .topbar {
  background: linear-gradient(180deg, #2a2218 0%, #221c14 100%);
  border-color: #3a3028;
}

body.dark .shopname { color: #f0e4d0; }
body.dark .greeting { color: #8a7a68; }
body.dark .tb-time { color: #7a6a58; }

body.dark .tb-btn {
  background: linear-gradient(180deg, #2e2418 0%, #261e12 100%);
  border-color: #4a3c28;
  color: #c8b090;
}

body.dark .stat { box-shadow: 0 8px 22px rgba(0,0,0,.4); }

body.dark .act {
  background: linear-gradient(180deg, #2a2218 0%, #221c14 100%);
  border-color: #3e3224;
  color: #d8c8b0;
}

body.dark .act.on {
  border-color: #c8943c;
}

body.dark .workspace {
  background: linear-gradient(180deg, #221c14 0%, #1e1810 100%);
  border-color: #3a3028;
}

body.dark .module-title { color: #f0e4d0; }
body.dark .module-sub { color: #8a7a68; }

body.dark .act-rapor-menu {
  background: linear-gradient(180deg, #2a2218 0%, #221c14 100%);
  border-color: #3a3028;
}

body.dark .act-rapor-item {
  color: #d8c8b0;
  border-color: #3a3028;
}

body.dark .act-rapor-item:hover {
  background: rgba(200, 148, 60, 0.15);
}

body.dark .overlay {
  background: linear-gradient(180deg, #1a1612 0%, #141210 100%);
}

body.dark .ov-card {
  background: linear-gradient(180deg, #2a2218 0%, #221c14 100%);
  border-color: #3a3028;
}

body.dark .ov-f input {
  background: #1e1810;
  border-color: #3e3224;
  color: #e0d0b8;
}

body.dark .ov-title { color: #e0d4c0; }
body.dark .ov-logo .shop { color: #f0e4d0; }
body.dark .ov-logo .sub { color: #8a7a68; }
