@import url('https://fonts.googleapis.com/css?family=Muli:300,400,700');

:root {
  color-scheme: light;
  --bg: #e8e8e8;
  --surface: #ffffff;
  --surface-muted: #f2f2f2;
  --text: #333333;
  --text-muted: #585a5f;
  --border: #dddddd;
  --input-border: #cccccc;
  --primary: #379392;
  --primary-hover: #2d7776;
  --primary-soft: rgba(55, 147, 146, 0.1);
  --secondary: #f8f9fa;
  --secondary-hover: #eeeeee;
  --danger: #d46473;
  --success: #28a745;
  --warning: #ffc107;
  --modal-backdrop: rgba(0, 0, 0, 0.46);
  --shadow: rgba(0, 0, 0, 0.16);
  --shadow-soft: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Muli', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

body.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

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

h1 {
  font-size: 16px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

h3 {
  font-size: 14px;
  line-height: 1.35;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #878787;
  font-size: 13px;
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(55, 147, 146, 0.18);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--text-muted);
}

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

.desktop-app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 820;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 18px;
  background: #333333;
  color: #ffffff;
}

.desktop-app-title {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.top-logout-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e5e5e5;
  font-size: 11px;
}

.app-sidebar {
  position: sticky;
  top: 44px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand a {
  color: #585a5f;
  font-size: 12px;
  text-decoration: none;
}

.sidebar-brand p {
  margin: 0 0 0 4px;
  color: #8a8d93;
  font-size: 10px;
}

.sidebar-nav,
.sidebar-actions {
  display: grid;
}

.sidebar-actions {
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.sidebar-link,
button.sidebar-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2f333e;
  font-size: 11px;
  text-align: left;
  text-decoration: none;
}

.sidebar-link::before,
button.sidebar-link::before {
  width: 16px;
  margin-right: 8px;
  font-size: 11px;
  content: '◎';
}

.sidebar-link:hover,
button.sidebar-link:hover,
.sidebar-link.is-active {
  background: var(--primary);
  color: #ffffff;
}

.app-content {
  min-width: 0;
  padding: 44px 12px 40px;
  background: var(--bg);
}

.content-header {
  margin-bottom: 0;
  padding: 8px 0 12px;
  color: var(--text-muted);
}

.content-header h1 {
  margin-bottom: 0;
  color: #585a5f;
  font-size: 10px;
  font-weight: 400;
}

.content-header p {
  display: none;
}

.mobile-app-header {
  display: none;
}

.mobile-app-title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.mobile-menu-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 910;
  background: var(--modal-backdrop);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mobile-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.mobile-menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 920;
  display: flex;
  flex-direction: column;
  width: min(380px, 88vw);
  height: 100vh;
  padding: 22px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: -12px 0 34px var(--shadow);
  transform: translateX(100%);
  transition: transform 0.24s ease;
}

.mobile-menu-drawer.is-open {
  transform: translateX(0);
}

.mobile-menu-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mobile-menu-drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.mobile-menu-drawer-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.mobile-menu-close {
  width: auto;
  min-height: 34px;
  padding: 0 16px;
  font-size: 12px;
}

.mobile-menu-drawer .sidebar-nav {
  display: grid;
  gap: 10px;
}

.mobile-menu-drawer .sidebar-link {
  width: 100%;
  justify-content: flex-start;
}

body.mobile-menu-open {
  overflow: hidden;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

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

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

@media (max-width: 860px) {
  .desktop-app-header {
    display: none;
  }

  .mobile-app-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 850;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 10px 16px;
    background: #333333;
    box-shadow: 0 8px 26px var(--shadow-soft);
  }

  .app-layout {
    display: block;
    padding-top: 58px;
  }

  .app-sidebar {
    display: none;
  }

  .app-content {
    padding: 22px 16px 44px;
  }

  .grid {
    display: block;
  }

  .grid > * {
    margin-bottom: 18px;
  }

  .span-6 {
    grid-column: span 12;
  }
}

@media (max-width: 560px) {
  body.center-page {
    padding: 16px;
  }

  .app-content {
    padding: 18px 14px 36px;
  }
}
