/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --background: #eef2f5;
  --surface: #ffffff;
  --surface-muted: #eef1f3;
  --border: #cfd8df;
  --text: #17202a;
  --muted: #617282;
  --accent: #006d9c;
  --accent-strong: #004f72;
  --danger: #a23b3b;
  --header: #243746;
  --header-strong: #152634;
  --header-text: #ffffff;
  --row-hover: #f4f8fb;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-header {
  align-items: center;
  background: linear-gradient(180deg, var(--header), var(--header-strong));
  border-bottom: 4px solid var(--accent);
  box-shadow: var(--shadow);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-block {
  display: grid;
  gap: 2px;
}

.brand-block span {
  color: #b9c8d3;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.app-brand {
  color: var(--header-text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.app-brand:hover {
  color: var(--header-text);
  text-decoration: none;
}

.app-header nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.app-header nav form {
  margin: 0;
}

.app-header nav a,
.nav-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: var(--header-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 10px;
}

.app-header nav a:hover,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.16);
  text-decoration: none;
}

.app-main {
  margin: 0 auto;
  max-width: 1360px;
  padding: 28px 32px 48px;
}

.page-header {
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 20px;
}

.page-header h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 4px;
}

.page-header p {
  color: var(--muted);
  margin: 0;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 48px auto;
  max-width: 420px;
  padding: 28px;
}

.auth-panel h1,
.data-section h2,
.detail-grid h2 {
  font-size: 20px;
  margin: 0 0 16px;
}

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

.field {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

input[type="search"],
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="email"],
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.search-form {
  display: flex;
  gap: 8px;
  min-width: min(520px, 100%);
}

.search-form input[type="search"] {
  flex: 1;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-action,
.secondary-action,
.search-form input[type="submit"] {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  min-height: 40px;
  padding: 8px 14px;
}

.secondary-action {
  background: var(--surface);
  color: var(--accent);
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link-button.danger {
  color: var(--danger);
}

.record-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

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

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

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-errors {
  background: #faeeee;
  border: 1px solid #edc7c7;
  border-radius: 8px;
  color: var(--danger);
  margin-bottom: 18px;
  padding: 14px;
}

.form-errors h2 {
  font-size: 16px;
  margin: 0 0 8px;
}

.form-errors ul {
  margin: 0;
}

.flash {
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 10px 12px;
}

.flash.notice {
  background: #e7f4ec;
  border: 1px solid #bedfca;
}

.flash.alert,
.flash.error {
  background: #faeeee;
  border: 1px solid #edc7c7;
  color: var(--danger);
}

.data-section {
  margin-top: 28px;
}

.data-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-collapse: collapse;
  box-shadow: var(--shadow);
  width: 100%;
}

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

.data-table th {
  background: #dfe7ec;
  color: #334756;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.data-table td {
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: var(--row-hover);
}

.table-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 28px;
}

.home-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  margin-bottom: 28px;
}

.memo-board,
.notice-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.memo-paper {
  background: #fffdf2;
  border: 1px solid #eadfbd;
  border-radius: 6px;
  color: #2f2a1f;
  min-height: 220px;
  padding: 16px;
}

.memo-paper p {
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 10px;
}

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

.notice-item {
  align-items: center;
  background: #f9fbfc;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
}

.notice-item:hover {
  background: var(--row-hover);
  text-decoration: none;
}

.notice-item strong {
  background: var(--accent);
  border-radius: 999px;
  color: #ffffff;
  min-width: 34px;
  padding: 3px 8px;
  text-align: center;
}

.panel-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  padding: 16px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 18px;
  margin: 0;
}

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

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

.menu-grid a {
  align-items: center;
  background: #f9fbfc;
  border: 1px solid #cbd7df;
  border-radius: 8px;
  color: var(--text);
  display: flex;
  font-weight: 800;
  min-height: 54px;
  padding: 12px;
}

.menu-grid a:hover {
  background: #eaf3f8;
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
}

.link-grid a {
  background: #f9fbfc;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  color: #1f2937;
  padding: 10px 12px;
  text-decoration: none;
}

.link-grid a:hover {
  border-color: #8aa2c7;
  color: #0f3f7a;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 18px;
}

.metric-card:hover {
  text-decoration: none;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-size: 14px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.filter-bar a {
  background: #f9fbfc;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
  min-width: 40px;
  padding: 7px 10px;
  text-align: center;
}

.filter-bar a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.detail-grid > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.definition-list {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: 96px minmax(0, 1fr);
  margin: 0;
}

.definition-list dt {
  color: var(--muted);
  font-weight: 700;
}

.definition-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.link-list {
  display: grid;
  gap: 10px;
}

.link-list a {
  background: var(--surface-muted);
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
  padding: 10px 12px;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  margin-top: 18px;
}

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  margin: 0;
  padding: 18px;
}

@media (max-width: 760px) {
  .app-header,
  .page-header,
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    position: static;
  }

  .app-main {
    padding: 18px;
  }

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

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

  .home-layout,
  .link-grid,
  .menu-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

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