:root {
  --bg: #f5efe7;
  --panel: #fffdf8;
  --panel-2: #fff7f0;
  --line: #e7d9ca;
  --text: #1f2933;
  --text-2: #586470;
  --muted: #7b8790;
  --accent: #e34b35;
  --accent-2: #0f3a55;
  --danger: #d9342b;
  --warning: #c98212;
  --input: #ffffff;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(227, 75, 53, 0.08), transparent 28rem),
    linear-gradient(135deg, #f9f4ec 0%, var(--bg) 46%, #fffaf4 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

button,
.file-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 8px 11px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.05);
}

button:hover,
.file-button:hover {
  border-color: rgba(227, 75, 53, 0.45);
  background: #fff7f0;
}

button.primary {
  border-color: rgba(227, 75, 53, 0.55);
  color: #ffffff;
  background: var(--accent);
}

button.accent {
  border-color: rgba(15, 58, 85, 0.32);
  color: #ffffff;
  background: var(--accent-2);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(227, 75, 53, 0.1);
  border: 1px solid rgba(227, 75, 53, 0.28);
  color: var(--accent);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p,
.records-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.service-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.service-nav button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  color: var(--text-2);
}

.service-nav button.active {
  color: var(--accent);
  border-color: rgba(227, 75, 53, 0.42);
  background: rgba(227, 75, 53, 0.1);
}

.new-service {
  width: 100%;
  margin-bottom: 16px;
  border-color: rgba(15, 58, 85, 0.24);
  color: var(--accent-2);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

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

.eyebrow,
.panel-title {
  color: var(--accent-2);
  font-family: "Space Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.panel.compact {
  padding: 12px;
}

.form-panel {
  min-width: 0;
}

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

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

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

.field.hidden {
  display: none;
}

.field label {
  color: var(--text-2);
  font-size: 12px;
}

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

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-2);
}

.side-panel {
  position: sticky;
  top: 18px;
}

.status,
.hint {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
}

.validation-list {
  min-height: 28px;
  margin: 10px 0 12px;
  padding-left: 18px;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
}

.validation-list.ok {
  padding-left: 0;
  list-style: none;
  color: #21784f;
}

.records-panel {
  margin-top: 14px;
}

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

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  border-bottom: 1px solid rgba(115, 129, 153, 0.18);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

td {
  color: var(--text-2);
}

td strong {
  color: var(--text);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions a {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--accent-2);
  text-decoration: none;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .side-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .records-header {
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .actions > * {
    flex: 1 1 140px;
  }

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