@font-face {
  font-family: "Thmanya";
  src: local("thmanyah Sans"), local("Thmanyah Sans"), local("Thmanya"), local("Thmanyah");
  font-display: swap;
}

:root {
  --orange: #f97316;
  --orange-dark: #c2410c;
  --orange-soft: #fff3e8;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf2ff;
  --green: #16a34a;
  --green-soft: #e9f8ee;
  --red: #dc2626;
  --red-soft: #fff0f0;
  --ink: #172033;
  --muted: #697386;
  --line: #e6ecf4;
  --surface: #ffffff;
  --soft: #f7f9fc;
  --page: #fbfcff;
  --shadow: 0 18px 55px rgba(20, 33, 54, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.14), transparent 28rem),
    linear-gradient(225deg, rgba(37, 99, 235, 0.12), transparent 26rem),
    var(--page);
  font-family: "Thmanya", "Segoe UI", Tahoma, Arial, sans-serif;
  font-weight: 400;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  white-space: nowrap;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.92), rgba(37, 99, 235, 0.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='rgba(255,255,255,.2)' stroke-width='1'%3E%3Cpath d='M0 80h160M80 0v160'/%3E%3Ccircle cx='80' cy='80' r='45'/%3E%3C/g%3E%3C/svg%3E");
}

.glass-panel {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.login-card {
  width: min(440px, 100%);
  border-radius: 8px;
  padding: 34px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  color: white;
  font-weight: 700;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 600;
}

.stack {
  display: grid;
  gap: 14px;
}

.compact {
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.quick-action {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white;
  box-shadow: 0 12px 26px rgba(249, 115, 22, 0.23);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-button {
  background: var(--blue);
  color: white;
}

.ghost-button {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.icon-button {
  background: var(--red-soft);
  color: var(--red);
  padding: 7px 10px;
  font-size: 12px;
}

.quick-action {
  background: white;
  color: var(--orange-dark);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(124, 45, 18, 0.14);
}

.full {
  width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: rgba(255, 255, 255, 0.88);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  backdrop-filter: blur(16px);
  min-width: 0;
}

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

.brand strong {
  display: block;
  font-weight: 700;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 7px;
  flex: 1;
  align-content: start;
  min-width: 0;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.nav-item::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-radius: 999px;
  background: #cbd5e1;
}

.nav-item:hover,
.nav-item.active {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.nav-item:hover::before,
.nav-item.active::before {
  background: var(--orange);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.user-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.user-card span {
  color: var(--muted);
  font-size: 12px;
}

.user-card strong {
  font-weight: 600;
}

.workspace {
  width: 100%;
  max-width: 1480px;
  padding: 26px;
  min-width: 0;
}

.topbar {
  min-height: 178px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  margin-bottom: 18px;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.96), rgba(37, 99, 235, 0.88)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.18), transparent);
  box-shadow: var(--shadow);
  min-width: 0;
}

.topbar .eyebrow {
  color: rgba(255, 255, 255, 0.86);
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 700;
}

.topbar p:last-child {
  max-width: 680px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.8;
}

.notice-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.notice.error {
  background: var(--red-soft);
  color: #b91c1c;
}

.notice.success {
  background: var(--green-soft);
  color: #15803d;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
}

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

.action-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  align-content: center;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 32px rgba(20, 33, 54, 0.055);
}

.action-card:hover {
  border-color: #fdba74;
  background: #fffaf5;
}

.action-card span {
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 600;
}

.action-card strong {
  font-size: 20px;
  line-height: 1.45;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 106px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 32px rgba(20, 33, 54, 0.055);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--orange);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.accent-blue::before {
  background: var(--blue);
}

.accent-green::before {
  background: var(--green);
}

.accent-red::before {
  background: var(--red);
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.primary-column,
.side-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(19, 32, 52, 0.055);
  padding: 18px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 700;
}

.panel-note,
.helper-text,
.empty-state,
.section-title span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.workflow-panel {
  border-top: 3px solid var(--orange);
}

.composer-panel {
  border-top: 3px solid var(--blue);
}

.compact-panel {
  padding: 16px;
}

.upload-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.file-drop {
  position: relative;
  min-height: 110px;
  justify-content: center;
  padding: 18px;
  border: 1px dashed #fdba74;
  border-radius: 8px;
  background: #fffaf5;
}

.file-drop span {
  color: var(--ink);
  font-weight: 600;
}

.file-drop small {
  color: var(--muted);
  line-height: 1.7;
}

.file-drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker {
  width: fit-content;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: white;
  border: 1px solid #fed7aa;
  color: var(--orange-dark);
  font-size: 13px;
  cursor: pointer;
}

.upload-insights {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.compact-insights {
  grid-template-columns: 1fr;
}

.upload-insights div {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  min-width: 0;
}

.upload-insights span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
  min-width: 0;
}

.upload-insights strong {
  display: block;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.variables-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title strong {
  font-weight: 600;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variables-box .chip-list {
  max-height: 152px;
  overflow: auto;
  padding-left: 2px;
}

.chip {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: var(--orange-dark);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
}

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

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

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  width: auto;
}

.item-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 310px;
  overflow: auto;
  padding-left: 2px;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 11px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid transparent;
}

.item strong {
  font-weight: 600;
}

.item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.tight .item {
  align-items: center;
  padding: 9px 10px;
}

.empty-state {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.compact-empty {
  margin-top: 10px;
}

.history-panel {
  margin-top: 18px;
}

.admin-panel {
  margin-top: 18px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.admin-create,
.admin-card {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.admin-list {
  display: grid;
  gap: 12px;
  max-height: 680px;
  overflow: auto;
  padding-left: 2px;
}

.admin-card {
  display: grid;
  gap: 14px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-head strong,
.admin-card-head span {
  display: block;
}

.admin-card-head span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.permissions-field {
  display: grid;
  gap: 10px;
}

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

.permission-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.permission-check input {
  width: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.owner {
  color: var(--orange-dark);
  background: var(--orange-soft);
}

.status-pill.active {
  color: #15803d;
  background: var(--green-soft);
}

.status-pill.inactive {
  color: #b91c1c;
  background: var(--red-soft);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  direction: ltr;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  direction: rtl;
}

th,
td {
  text-align: right;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--soft);
}

tbody tr:hover {
  background: #fffaf5;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
}

.status.completed {
  background: var(--green-soft);
  color: #15803d;
}

.status.failed,
.status.cancelled {
  background: var(--red-soft);
  color: #b91c1c;
}

.status.running,
.status.queued,
.status.draft,
.status.paused {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

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

@media (max-width: 820px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 26px;
  }

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

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

  .upload-box,
  .form-grid,
  .upload-insights,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .section-title,
  .panel-heading,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 14px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

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

  .nav-item {
    justify-content: center;
    min-height: 40px;
    padding: 9px;
    text-align: center;
  }

  .nav-item::before {
    display: none;
  }

  .sidebar-footer {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 20px;
  }

  .quick-action,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .metrics-strip {
    grid-template-columns: 1fr;
  }

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

  .metric-card {
    min-height: 88px;
  }

  .panel {
    padding: 14px;
  }

  .item {
    align-items: stretch;
    flex-direction: column;
  }

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

  .login-card {
    padding: 24px;
  }
}
