/* EasyScreen Backoffice UI */
:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --text: #111111;
  --muted: #666666;
  --faint: #8a8f98;
  --line: #e6e6e6;
  --line-strong: #d8d8d8;
  --black: #000000;
  --success: #0a7a3d;
  --warning: #9a6700;
  --danger: #c62828;
  --danger-bg: #fff1f1;
  --info-bg: #eef6ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 540;
}

label > span {
  color: #4d4d4d;
  font-size: 13px;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 12px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--black);
  border-radius: 7px;
  background: var(--black);
  color: #ffffff;
  font-size: 12px;
  font-weight: 760;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

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

.button.primary {
  border-color: var(--black);
  background: var(--black);
  color: #ffffff;
}

.button.secondary {
  background: var(--panel);
  color: var(--text);
}

.text-link,
.card-link,
.table-action {
  color: var(--black);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 620;
}

.alert.error {
  border: 1px solid #ffd0d0;
  background: var(--danger-bg);
  color: #9d1f1f;
}

/* Login */
.login-body {
  background:
    linear-gradient(90deg, #ffffff 0, #ffffff 49.95%, #f7f7f8 50%, #f7f7f8 100%);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  min-height: 100vh;
}

.login-definition,
.login-panel {
  display: flex;
  min-height: 100vh;
  padding: clamp(28px, 5vw, 72px);
}

.login-definition {
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    #ffffff;
  background-size: 48px 48px;
}

.login-brand {
  width: fit-content;
}

.definition-copy {
  max-width: 680px;
  padding: 80px 0;
}

.definition-copy h1 {
  max-width: 780px;
}

.definition-copy p {
  max-width: 560px;
  font-size: 18px;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}

.definition-grid div {
  min-height: 142px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.definition-grid span {
  display: block;
  margin-bottom: 28px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.definition-grid strong {
  display: block;
  margin-bottom: 6px;
}

.definition-grid p {
  margin: 0;
  font-size: 13px;
}

.login-panel {
  align-items: center;
  justify-content: center;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: clamp(24px, 4vw, 38px);
  box-shadow: var(--shadow);
}

.form-heading {
  margin-bottom: 8px;
}

.form-heading h2,
.form-heading p {
  margin-bottom: 8px;
}

/* App layout */
.app-body {
  background: var(--bg);
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 22px;
}

.side-nav {
  display: grid;
  gap: 5px;
  margin-top: 34px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 12px;
  color: #4b5563;
  font-weight: 620;
}

.side-nav a:hover,
.side-nav a.active {
  background: #f2f2f2;
  color: var(--text);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
}

.side-nav a.active .nav-dot {
  background: currentColor;
}

.sidebar-footer {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.sidebar-footer strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.sidebar-footer small {
  color: var(--faint);
  font-size: 12px;
}

.main-panel {
  width: 100%;
  min-width: 0;
  padding: clamp(22px, 4vw, 48px);
}

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.page-hero.compact {
  align-items: center;
}

.page-hero p {
  max-width: 670px;
  margin-bottom: 0;
  font-size: 17px;
}

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

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

.metric-card {
  display: grid;
  align-content: start;
  min-height: 228px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 23px;
  line-height: 1.15;
}

.metric-card p {
  margin-bottom: 22px;
}

.metric-card .card-link {
  margin-top: auto;
}

.metric-label {
  display: inline-block;
  margin-bottom: 38px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.content-band,
.form-panel,
.table-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.content-band,
.form-panel,
.empty-state {
  padding: clamp(20px, 3vw, 30px);
}

.section-heading h2,
.section-heading .eyebrow {
  margin-bottom: 8px;
}

.action-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.action-list a {
  display: flex;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  background: #ffffff;
  padding: 16px;
}

.action-list a:hover {
  background: #fafafa;
}

.action-index {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.action-list strong,
.action-list small {
  display: block;
}

.action-list small {
  margin-top: 3px;
  color: var(--muted);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 280px;
  align-content: center;
}

.empty-state p {
  max-width: 520px;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--faint);
  font-size: 24px;
}

/* Forms */
.form-panel {
  display: grid;
  gap: 30px;
}

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

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

.conditional-field[hidden] {
  display: none;
}

.file-field input {
  display: flex;
  align-items: center;
  padding: 9px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

/* Tables */
.table-card {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.table-header h2 {
  margin-bottom: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--panel);
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--faint);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.data-table td {
  color: #2d2d2d;
  font-size: 14px;
}

.data-table td strong,
.data-table td small {
  display: block;
}

.data-table td small {
  margin-top: 4px;
  color: var(--faint);
}

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

.pill,
.level {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: #f8f8f8;
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.pill-success {
  border-color: #bde2cd;
  background: #effaf3;
  color: var(--success);
}

.pill-muted {
  border-color: #dedede;
  background: #f5f5f5;
  color: #5f6570;
}

.scope {
  display: grid;
  gap: 4px;
}

.scope small {
  margin-top: 0;
}

.logs-table {
  min-width: 1120px;
}

.logs-table pre {
  max-width: 260px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #444444;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.level-info {
  border-color: #b7dcff;
  background: var(--info-bg);
  color: #075985;
}

.level-warn {
  border-color: #f4d58a;
  background: #fff8df;
  color: var(--warning);
}

.level-error,
.level-critical {
  border-color: #ffc3c3;
  background: var(--danger-bg);
  color: var(--danger);
}

.users-table {
  min-width: 1080px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form {
  display: inline;
}

.table-button {
  background: transparent;
  padding: 0;
}

.disabled-action {
  color: var(--faint);
  text-decoration: none;
}

.read-only-box {
  display: grid;
  gap: 4px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f7f7;
  padding: 11px 12px;
}

.read-only-box strong {
  font-size: 14px;
}

.read-only-box small {
  color: var(--faint);
  font-size: 12px;
}

.switch-field .switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0 12px;
}

.switch-field input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

.switch-field .switch-row span {
  font-weight: 620;
}

.form-help {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}

.span-2 {
  grid-column: span 2;
}

.tickets-table {
  min-width: 1200px;
}

.tickets-table td small {
  max-width: 320px;
}

.ticket-detail-grid .metric-card {
  min-height: 190px;
}

.ticket-meta-band {
  margin-top: 14px;
}

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

.ticket-meta-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.ticket-meta-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ticket-meta-grid strong {
  display: block;
  margin-bottom: 4px;
  word-break: break-word;
}

.ticket-meta-grid small {
  color: var(--muted);
}

.ticket-status-form {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 980px) {
  .login-body {
    background: #ffffff;
  }

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

  .login-definition,
  .login-panel {
    min-height: auto;
  }

  .login-definition {
    gap: 34px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .definition-copy {
    padding: 28px 0 0;
  }

  .definition-grid,
  .metric-grid,
  .detail-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .ticket-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .sidebar {
    position: static;
    min-height: auto;
    gap: 16px;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .page-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-definition,
  .login-panel,
  .main-panel {
    padding: 22px;
  }

  h1 {
    font-size: 38px;
  }

  .definition-grid div,
  .metric-card {
    min-height: auto;
  }

  .page-hero .button,
  .form-actions .button,
  .auth-card .button {
    width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }

  .ticket-status-form .button {
    width: 100%;
  }
}
