:root {
  color-scheme: light;
  --ink: #1d1c22;
  --muted: #6d6a75;
  --accent: #1f5c6a;
  --accent-strong: #0b3f4b;
  --surface: #ffffff;
  --surface-muted: #f1f0f2;
  --surface-deep: #e6e4e8;
  --border: #d4d2d8;
  --shadow: 0 14px 30px rgba(24, 24, 32, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #f8efe2, #e6eef0 45%, #edf0f6 75%);
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.universal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-action {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-strong);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-menu {
  position: relative;
}

.profile-button {
  border: none;
  background: var(--accent-strong);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  min-width: 160px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.2s ease;
}

.profile-menu.open .profile-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.profile-item:hover {
  background: var(--surface-muted);
}

.layout-root {
  flex: 1;
  padding: 18px;
  min-height: 0;
  overflow: hidden;
}

.lm_goldenlayout {
  background: transparent;
  height: 100%;
}

.lm_content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.widget-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.widget-header {
  padding: 12px 16px;
  background: var(--surface-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.widget-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.panel-toolbar button,
.detail-mark {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-strong);
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.panel-toolbar button:hover,
.detail-mark:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.updates-table {
  flex: 1;
}

.updates-fallback {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.updates-fallback-row {
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-status {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-status.is-read {
  color: var(--accent);
}

.detail-title {
  margin: 0;
  font-size: 20px;
}

.detail-summary {
  margin: 0;
  color: var(--muted);
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-body {
  font-size: 15px;
  line-height: 1.5;
}

.notice {
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.functions-root {
  flex: 1;
  padding: 24px;
}

.functions-intro {
  margin: 0 0 18px;
  font-size: 16px;
  color: var(--muted);
}

.functions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.function-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.function-card:hover {
  border-color: var(--accent);
}

.function-card-title {
  font-weight: 600;
  font-size: 16px;
}

.function-card-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.bank-import-root {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.bank-import-card {
  width: min(720px, 100%);
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bank-import-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bank-import-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.bank-import-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.bank-import-button {
  border: 1px solid var(--border);
  background: var(--accent-strong);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bank-import-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--accent-strong);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bank-import-status {
  min-height: 22px;
  color: var(--muted);
}

.bank-table {
  flex: 1;
}

.bank-table,
.bank-table .tabulator {
  width: 100%;
}

.bank-detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
}

.bank-detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bank-detail-value {
  font-size: 14px;
}

.bank-detail-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.bank-detail-textarea {
  min-height: 90px;
  resize: vertical;
}

.bank-detail-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.bank-detail-save {
  align-self: flex-start;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-strong);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.bank-panel .widget-body {
  overflow: hidden;
}

.bank-detail .widget-body {
  overflow-y: auto;
  padding-right: 8px;
}

.documents-root {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.view {
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr 360px;
  grid-template-rows: auto 1fr;
}

.documents-root .view {
  flex: 1;
  min-height: 0;
}

.toolbar {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.toolbar input[type="search"] {
  width: 320px;
  max-width: 50vw;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.toolbar button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.toolbar button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 10px 12px;
  overflow: auto;
  background: var(--surface);
}

.sidebar h3 {
  margin: 12px 0 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar .item {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar .item:hover {
  background: var(--surface-muted);
}

.main {
  padding: 10px 12px;
  overflow: hidden;
  background: var(--surface);
}

.preview {
  border-left: 1px solid var(--border);
  padding: 10px 12px;
  overflow: auto;
  background: var(--surface-muted);
}

.preview .placeholder {
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 12px;
  color: var(--muted);
}

.bizdocs-detail .form-field {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.bizdocs-detail .form-field input,
.bizdocs-detail .form-field select,
.bizdocs-detail .form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background: var(--surface);
}

.bizdocs-detail .form-field textarea {
  resize: vertical;
}

.bizdocs-detail .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.bizdocs-totals {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.plain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.plain-table th,
.plain-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.plain-table th {
  position: sticky;
  top: 0;
  background: var(--surface-muted);
  z-index: 1;
}

.inbox-layout {
  height: 100%;
}

.golden-layout-root {
  height: 100%;
}

.inbox-layout .lm_goldenlayout {
  height: 100%;
}

.inbox-layout .lm_content {
  overflow: hidden;
}

.inbox-layout .lm_content > .widget-shell {
  height: 100%;
}

.widget-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.widget-toolbar input[type="search"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.widget-toolbar button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.inbox-entry-table {
  flex: 1;
  min-height: 0;
}

.pdf-viewer .widget-body {
  align-items: center;
}

.pdf-toolbar {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
}

.pdf-toolbar button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.pdf-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pdf-thumbnails .widget-body {
  overflow: hidden;
}

.thumbnail-status {
  font-size: 12px;
  color: var(--muted);
}

.thumbnail-list {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.thumbnail-item {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.thumbnail-canvas {
  width: 100%;
  height: auto;
}

.thumbnail-label {
  font-size: 11px;
  color: var(--muted);
}

.attribute-editor .widget-body {
  overflow: auto;
}

.attribute-empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
}

.attribute-form {
  display: none;
  gap: 10px;
}

.attribute-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.attribute-field input,
.attribute-field select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.attribute-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.attribute-actions button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

.attribute-status {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .universal-header {
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    order: 3;
    justify-content: flex-start;
  }

  .layout-root {
    padding: 12px;
  }
}
