/* Atölye — açık tema (zeytin & kağıt) */

:root {
  --bg:         #F7F3ED;
  --bg-2:       #FFFFFF;
  --bg-3:       #F0EAE0;
  --bg-4:       #EBE3D5;

  --paper:      #FFFFFF;
  --paper-w:    #FBF8F3;

  --text:       #3D2E1F;
  --text-2:     #6B5842;
  --text-3:     #A08C71;

  --olive:      #6B7F4C;
  --olive-d:    #5A6D3D;
  --olive-l:    #8EA168;
  --olive-bg:   #EBF0DE;

  --terra:      #B25A3E;
  --terra-l:    #D67E5F;
  --terra-bg:   #F5E1DA;

  --rule:       #E0D8CB;
  --rule-2:     #D2C8B6;

  --danger:     #B25A3E;
  --success:    #6B7F4C;
  --warn:       #C9954A;
  --warn-bg:    #F5EAD5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--olive); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--olive-d); text-decoration: underline; }

.topnav {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 100;
}
.topnav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 40px;
  padding: 14px 32px;
}
.brand { display: flex; flex-direction: column; text-decoration: none; }
.brand-name {
  font-family: Georgia, serif; font-style: italic;
  font-size: 24px; color: var(--olive); font-weight: normal; line-height: 1;
}
.brand-tag {
  font-family: Georgia, serif; font-size: 10px;
  color: var(--text-3); margin-top: 3px; letter-spacing: 0.05em; font-style: italic;
}
.brand:hover { text-decoration: none; }
.brand:hover .brand-name { color: var(--olive-d); }

.nav-links { list-style: none; display: flex; gap: 24px; margin-left: auto; margin-right: 40px; }
.nav-links a {
  color: var(--text-2); font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--olive); border-bottom-color: var(--olive); }

.nav-user { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-2); }
.nav-user .uname { color: var(--olive-d); font-weight: 500; }
.nav-user .logout {
  color: var(--text-3); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
}

.main { flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; padding: 32px; }

.footer {
  text-align: center; padding: 24px;
  color: var(--text-3); font-size: 12px;
  border-top: 1px solid var(--rule);
  font-family: Georgia, serif; font-style: italic;
}

.page-head { margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.page-head h1 {
  font-family: Georgia, serif; font-style: italic;
  font-weight: normal; font-size: 32px; color: var(--text); margin-bottom: 6px;
}
.page-head .subtitle { color: var(--text-2); font-size: 14px; }

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 20px;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 2px 12px rgba(107, 88, 66, 0.08); }
.card-title {
  font-family: Georgia, serif; font-style: italic;
  color: var(--olive-d); font-size: 18px; font-weight: normal; margin-bottom: 16px;
}

/* Dashboard */
.dash-hero {
  background: linear-gradient(135deg, var(--olive-bg) 0%, var(--paper) 100%);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 32px 36px;
  margin-bottom: 28px;
}
.dash-hero h1 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  color: var(--olive-d); font-size: 38px; margin-bottom: 8px; line-height: 1.15;
}
.dash-hero p { color: var(--text-2); font-size: 15px; max-width: 640px; }
.dash-hero .greeting-small {
  color: var(--olive); font-size: 12px;
  letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 10px; font-weight: 500;
}

.dash-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 32px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-section h2 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  color: var(--text); font-size: 22px; margin-bottom: 16px;
}
.dash-section .head-row {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px;
}
.dash-section .head-row a {
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--olive-d);
}

.proj-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.proj-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: block;
  min-height: 140px;
  position: relative;
}
.proj-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(107, 88, 66, 0.1);
  border-color: var(--olive-l);
  text-decoration: none;
}
.proj-card .emoji { font-size: 28px; margin-bottom: 12px; display: block; }
.proj-card .name {
  font-family: Georgia, serif; font-style: italic;
  color: var(--text); font-size: 16px; font-weight: normal;
  margin-bottom: 6px; line-height: 1.3;
}
.proj-card .desc {
  color: var(--text-2); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.proj-card .meta {
  color: var(--text-3); font-size: 11px;
  display: flex; gap: 12px; margin-top: auto;
}
.proj-card .kind-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--olive-d); background: var(--olive-bg);
  padding: 3px 8px; border-radius: 3px;
}

.empty {
  text-align: center; padding: 48px 24px;
  color: var(--text-3);
  background: var(--bg-3);
  border-radius: 6px;
  border: 1px dashed var(--rule-2);
}
.empty .eicon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }
.empty h3 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  color: var(--text-2); font-size: 18px; margin-bottom: 8px;
}
.empty p { font-size: 13px; margin-bottom: 16px; }

.dash-side .card { padding: 20px; }
.dash-side .card h3 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  color: var(--olive-d); font-size: 16px; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
.dash-side .chat-item {
  display: block; padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.4;
}
.dash-side .chat-item:last-child { border-bottom: none; }
.dash-side .chat-item:hover { color: var(--olive-d); text-decoration: none; }
.dash-side .chat-item .cmeta { color: var(--text-3); font-size: 11px; margin-top: 3px; }

.nudge {
  background: var(--olive-bg);
  border-left: 3px solid var(--olive);
  padding: 12px 14px; border-radius: 3px;
  margin-bottom: 10px;
  font-size: 13px; color: var(--text);
}
.nudge.warn { background: var(--warn-bg); border-color: var(--warn); }
.nudge.info { background: var(--terra-bg); border-color: var(--terra); }
.nudge a { font-weight: 500; }

.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 700px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
}
.stat .n {
  font-family: Georgia, serif; font-style: italic;
  font-size: 32px; color: var(--olive-d); line-height: 1;
}
.stat .l {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); margin-top: 8px;
}

/* Create tiles */
.create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-top: 16px;
}
.create-tile {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer; text-decoration: none;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s;
  display: block;
}
.create-tile:hover { transform: translateY(-2px); border-color: var(--olive); text-decoration: none; }
.create-tile .icon { font-size: 36px; margin-bottom: 10px; display: block; }
.create-tile .title {
  font-family: Georgia, serif; font-style: italic;
  color: var(--text); font-size: 15px; margin-bottom: 4px;
}
.create-tile .subtitle { color: var(--text-3); font-size: 11px; letter-spacing: 0.05em; }

/* Forms */
.field { margin-bottom: 20px; }
.field label {
  display: block; color: var(--text-2);
  font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; margin-bottom: 6px; font-weight: 500;
}
.field .hint { color: var(--text-3); font-size: 12px; margin-top: 4px; font-style: italic; }
input[type=text], input[type=password], input[type=email], input[type=file],
select, textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--olive); }
textarea { min-height: 100px; resize: vertical; }
textarea.mono { font-family: Menlo, 'Courier New', monospace; font-size: 13px; }

.btn {
  display: inline-block;
  background: var(--olive);
  color: var(--paper);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--olive-d); text-decoration: none; color: var(--paper); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-ghost { background: transparent; border: 1px solid var(--olive); color: var(--olive); }
.btn.btn-ghost:hover { background: var(--olive); color: var(--paper); }
.btn.btn-danger { background: var(--terra); color: var(--paper); }
.btn.btn-danger:hover { background: #922C0D; color: var(--paper); }
.btn.btn-sm { padding: 6px 12px; font-size: 11px; }

.btn-row { display: flex; gap: 12px; margin-top: 16px; }

.alert {
  padding: 12px 16px; border-radius: 4px;
  margin-bottom: 20px; font-size: 14px;
  border-left: 3px solid;
}
.alert.error   { background: var(--terra-bg); border-color: var(--terra); color: #7A2D18; }
.alert.success { background: var(--olive-bg); border-color: var(--olive); color: #3F5029; }
.alert.info    { background: var(--warn-bg); border-color: var(--warn); color: #6D5024; }

/* Login */
body.login-page {
  background: linear-gradient(135deg, var(--olive-bg) 0%, var(--bg) 100%);
  justify-content: center; align-items: center;
}
body.login-page .main { max-width: 400px; }
body.login-page .brand-block { text-align: center; margin-bottom: 32px; }
body.login-page .brand-block .brand-name {
  font-family: Georgia, serif; font-style: italic;
  font-size: 56px; color: var(--olive-d); font-weight: normal;
}
body.login-page .brand-block .brand-tag {
  font-family: Georgia, serif; font-size: 14px;
  color: var(--olive); margin-top: 8px; font-style: italic;
}

/* Chat */
.chat-shell {
  display: grid; grid-template-columns: 260px 1fr; gap: 24px;
  min-height: calc(100vh - 220px);
}
@media (max-width: 800px) { .chat-shell { grid-template-columns: 1fr; } }
.chat-sidebar { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 16px; }
.chat-sidebar h3 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  color: var(--olive-d); font-size: 14px; margin-bottom: 12px;
}
.chat-sidebar .newchat-btn { width: 100%; margin-bottom: 16px; padding: 10px; }
.chat-list { list-style: none; }
.chat-list li a {
  display: block; padding: 10px 12px;
  color: var(--text-2); font-size: 13px;
  border-radius: 4px; margin-bottom: 2px;
  text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-list li a:hover { background: var(--bg-3); color: var(--text); }
.chat-list li a.active { background: var(--olive-bg); color: var(--olive-d); }

.chat-main { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; display: flex; flex-direction: column; }
.chat-header {
  padding: 16px 24px; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
}
.chat-header h2 {
  font-family: Georgia, serif; font-style: italic; font-weight: normal;
  font-size: 18px; color: var(--text);
}
.chat-header .model-picker {
  background: var(--bg-3); color: var(--text-2);
  border: 1px solid var(--rule); padding: 6px 10px;
  border-radius: 4px; font-size: 12px;
}

.chat-messages { flex: 1; padding: 24px; overflow-y: auto; min-height: 400px; max-height: calc(100vh - 400px); }
.msg { margin-bottom: 24px; max-width: 90%; }
.msg.user { margin-left: auto; }
.msg-role {
  font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 6px;
}
.msg.user .msg-role { color: var(--olive); text-align: right; }
.msg.assistant .msg-role { color: var(--olive-d); }
.msg-content {
  background: var(--bg-3); padding: 14px 18px;
  border-radius: 8px; white-space: pre-wrap; word-wrap: break-word;
  line-height: 1.6; font-size: 14.5px;
}
.msg.user .msg-content { background: var(--olive-bg); border-top-right-radius: 2px; color: var(--text); }
.msg.assistant .msg-content { background: var(--bg-3); border-top-left-radius: 2px; }
.msg-content code {
  background: rgba(0,0,0,0.06); padding: 2px 5px;
  border-radius: 3px; font-family: 'Menlo', 'Courier New', monospace;
  font-size: 13px; color: var(--terra);
}
.msg-content pre {
  background: rgba(0,0,0,0.06); padding: 12px;
  border-radius: 4px; overflow-x: auto; margin: 8px 0;
  font-family: 'Menlo', 'Courier New', monospace; font-size: 13px;
}
.msg-tokens { font-size: 10px; color: var(--text-3); margin-top: 4px; text-align: right; }

.chat-input { padding: 16px 24px; border-top: 1px solid var(--rule); }
.chat-input form { display: flex; gap: 12px; }
.chat-input textarea { flex: 1; min-height: 60px; max-height: 200px; resize: none; font-family: inherit; font-size: 14px; }
.chat-input .btn { align-self: flex-end; }

/* Tables */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--paper); border-radius: 6px; overflow: hidden;
  border: 1px solid var(--rule);
}
table.data th, table.data td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--rule); }
table.data th {
  color: var(--olive-d); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 600;
  background: var(--bg-3);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-3); }

/* Project files */
.file-list { list-style: none; }
.file-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.file-list li:last-child { border-bottom: none; }
.file-list .fname { font-weight: 500; color: var(--text); }
.file-list .fmeta { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.file-list .factions { display: flex; gap: 8px; }

.upload-zone {
  border: 2px dashed var(--rule-2);
  border-radius: 6px;
  padding: 32px; text-align: center;
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--olive); background: var(--olive-bg); }
.upload-zone p { color: var(--text-2); font-size: 14px; }
.upload-zone .uz-icon { font-size: 32px; opacity: 0.5; margin-bottom: 8px; }

.muted { color: var(--text-3); }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }

.badge {
  display: inline-block; font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 3px;
  background: var(--bg-3); color: var(--text-2);
}
.badge.ok       { background: var(--olive-bg); color: var(--olive-d); }
.badge.pending  { background: var(--warn-bg); color: #7A5824; }
.badge.err      { background: var(--terra-bg); color: #7A2D18; }
.badge.subtle   { background: var(--paper); border: 1px solid var(--rule); color: var(--text-3); }
